예제 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            BackgroundView.BackgroundColor = UIColor.Clear;
            BackgroundView.BorderColor     = UIExtensions.RGBColor(0xFFFFFF);
            BackgroundView.Border          = 2.0f;
            BackgroundView.Gradient        = new GradientHelper(CMUIColors.SecondaryColorADark);


            ButtonPropertyManager m;

            m = new ButtonPropertyManager(NameButton, MainUI.MainView, _feat, "Name")
            {
                Title = "Name", Multiline = false
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(PrerequisitesButton, MainUI.MainView, _feat, "Prerequistites")
            {
                Title = "Prerequisites", Multiline = false
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(BenefitButton, MainUI.MainView, _feat, "Benefit")
            {
                Multiline = true
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(NormalButton, MainUI.MainView, _feat, "Normal")
            {
                Multiline = true
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(SpecialButton, MainUI.MainView, _feat, "Special")
            {
                Multiline = true
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(TypesButton, MainUI.MainView, _feat, "Type")
            {
                StringList = true
            };
            _Managers.Add(m);
            List <KeyValuePair <object, string> > types = new List <KeyValuePair <object, string> >();

            foreach (String s in Feat.FeatTypes)
            {
                types.Add(new KeyValuePair <object, string>(s, s));
            }
            m.ValueList = types;


            foreach (GradientButton b in from x in _Managers select x.Button)
            {
                CMStyles.TextFieldStyle(b, 15f);
            }
        }
        public SpecialAbilityView(Monster monster, SpecialAbility ability)
        {
            _Monster = monster;
            _Ability = ability;


            BackgroundColor = UIColor.Clear;
            BorderColor     = 0xFFFFFFFF.UIColor();
            Border          = 2.0f;
            Gradient        = new GradientHelper(CMUIColors.PrimaryColorDark);


            _DeleteButton = new UIButton();
            _DeleteImage  = UIImage.FromFile("Images/External/redx.png");
            _DeleteButton.SetImage(_DeleteImage, UIControlState.Normal);
            _DeleteButton.TouchUpInside += delegate
            {
                _Monster.SpecialAbilitiesList.Remove(_Ability);
            };

            _SpecialTextButton = new GradientButton();
            _SpecialTextButton.SetTitleColor(0x00000000.UIColor(), UIControlState.Normal);
            _SpecialTextManager = new ButtonPropertyManager(_SpecialTextButton, MainUI.MainView, _Ability, "Text")
            {
                Multiline = true
            };
            _Manager.Add(_SpecialTextManager);

            _NameButton = new GradientButton();
            CMStyles.TextFieldStyle(_NameButton);
            _Manager.Add(new ButtonPropertyManager(_NameButton, MainUI.MainView, _Ability, "Name"));

            _TypeButton = new GradientButton();
            ButtonPropertyManager typeMan = new ButtonPropertyManager(_TypeButton, MainUI.MainView, _Ability, "Type");

            typeMan.ValueList = new List <KeyValuePair <object, string> > {
                new KeyValuePair <object, string>("Ex", "Ex"),
                new KeyValuePair <object, string>("Sp", "Sp"),
                new KeyValuePair <object, string>("Su", "Su"),
                new KeyValuePair <object, string>("", "-"),
            };
            _Manager.Add(typeMan);

            Add(_DeleteButton);
            Add(_NameButton);
            Add(_TypeButton);
            Add(_SpecialTextButton);

            LayoutSubviews();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (View.Bounds.Height > View.Bounds.Width)
            {
                View.SetSize((float)View.Bounds.Height, (float)View.Bounds.Width);
            }


            ButtonView.CornerRadius    = 0;
            ButtonView.Border          = 0;
            ButtonView.Gradient        = new GradientHelper(0x0.UIColor());
            ButtonView.BackgroundColor = UIColor.Clear;

            TitleView.CornerRadius    = 0;
            TitleView.Border          = 0;
            TitleView.Gradient        = new GradientHelper(0x0.UIColor());
            TitleView.BackgroundColor = UIColor.Clear;

            if (!importMode)
            {
                TitleLabel.Text = "Select Items to Export";
            }

            CMStyles.StyleBasicPanel(BackgroundView);

            OKButton.StyleStandardButton();
            CancelButton.StyleStandardButton();

            BackgroundButton.TouchUpInside += (sender, e) => {
                this.View.RemoveFromSuperview();
            };


            SelectAllButton.TouchUpInside += (sender, e) => {
                foreach (ChecklistItem item in lists[selectedList])
                {
                    item.IsChecked = true;
                }
                FileTableView.ReloadData();
            };

            FileTableView.Delegate   = viewDelegate;
            FileTableView.DataSource = viewDataSource;

            _SelectedIndex = -1;
            UpdateOK();
        }
예제 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (View.Bounds.Height > View.Bounds.Width)
            {
                View.SetSize((float)View.Bounds.Height, (float)View.Bounds.Width);
            }


            ButtonView.CornerRadius    = 0;
            ButtonView.Border          = 0;
            ButtonView.Gradient        = new GradientHelper(0x0.UIColor());
            ButtonView.BackgroundColor = UIColor.Clear;

            TitleView.CornerRadius    = 0;
            TitleView.Border          = 0;
            TitleView.Gradient        = new GradientHelper(0x0.UIColor());
            TitleView.BackgroundColor = UIColor.Clear;

            CMStyles.StyleBasicPanel(BackgroundView);

            OKButton.StyleStandardButton();
            CancelButton.StyleStandardButton();

            OKButton.TouchUpInside         += HandleOKButtonTouchUpInside;
            CancelButton.TouchUpInside     += HandleCancelButtonTouchUpInside;
            BackgroundButton.TouchUpInside += HandleCancelButtonTouchUpInside;

            FileNameText.AllEditingEvents += HandleFileNameTextAllEditingEvents;

            FileTableView.Delegate   = viewDelegate;
            FileTableView.DataSource = viewDataSource;

            _SelectedIndex = -1;
            UpdateOK();

            if (_OpenMode)
            {
                FileNameText.Enabled = false;
            }
            else
            {
                TitleLabel.Text = "Save File";
            }
        }
예제 #5
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("CurrentFeatsViewCell");

                if (cell == null)
                {
                    cell = new DataListViewCell(UITableViewCellStyle.Default, "CurrentFeatsViewCell");
                }


                Spell.SpellAdjuster.LevelAdjusterInfo info = state._spell.Adjuster.Levels[indexPath.Row];


                cell.TextLabel.Text = info.Class;

                cell.TextLabel.Font = UIFont.SystemFontOfSize(15);

                GradientButton b = new GradientButton();

                b.Frame           = new CGRect(0, 3, 160, 22);
                b.TitleLabel.Font = UIFont.SystemFontOfSize(15);
                CMStyles.TextFieldStyle(b);
                b.SetText(info.Class);
                b.TouchUpInside += (sender, e) => state.SpellLevelClicked(info);
                UIView   view = new UIView();
                UIButton x    = new UIButton();
                UIImage  redx = UIImage.FromFile("Images/External/redx.png");

                x.SetImage(redx, UIControlState.Normal);
                x.Frame          = new CGRect(165, 0, redx.Size.Width, redx.Size.Height);
                x.TouchUpInside += (sender, e) => state.DeleteLevelClicked(info);

                view.Bounds = new CGRect(0, 0, x.Frame.Right, x.Frame.Bottom);
                view.Add(b);
                view.Add(x);


                cell.AccessoryView = view;


                return(cell);
            }
예제 #6
0
 protected void StylePanel(GradientView panel)
 {
     CMStyles.StyleBasicPanel(panel);
 }
예제 #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            StyleButton(OKButton);
            StyleButton(CancelButton);

            StylePanel1(this.AttackTextView);
            StyleBackground(BackgroundView);

            CMStyles.StyleBasicPanel(EditingView);

            MeleeView.Editable  = false;
            MeleeView.Text      = _Monster.MeleeString(_Attacks);
            RangedView.Editable = false;
            RangedView.Text     = _Monster.RangedString(_Attacks);

            _ScrollView     = new UIScrollView();
            _SetChoiceView  = new GradientView();
            _SetControlView = new GradientView();

            _NextSetButton = new GradientButton();
            _NextSetButton.SetImage(UIExtensions.GetSmallIcon("next"), UIControlState.Normal);
            _NextSetButton.TouchUpInside += HandleNextSetButtonClicked;
            _LastSetButton = new GradientButton();
            _LastSetButton.SetImage(UIExtensions.GetSmallIcon("prev"), UIControlState.Normal);
            _LastSetButton.TouchUpInside += HandleLastSetButtonClicked;

            _SetLabel                 = new UILabel();
            _SetLabel.Font            = UIFont.BoldSystemFontOfSize(16);
            _SetLabel.BackgroundColor = 0x00000000.UIColor();
            _SetLabel.TextColor       = 0xFFFFFFFF.UIColor();
            _SetLabel.TextAlignment   = UITextAlignment.Center;

            _SetChoiceView.Add(_NextSetButton);
            _SetChoiceView.Add(_LastSetButton);
            _SetChoiceView.Add(_SetLabel);


            _AddAttackButton = new GradientButton();
            _AddAttackButton.SetText("Add Attack");
            StyleButton(_AddAttackButton);

            _AddSetButton = new GradientButton();
            _AddSetButton.SetText("Add");
            StyleButton(_AddSetButton);
            _SetChoiceView.Add(_AddSetButton);


            _DeleteSetButton = new GradientButton();
            _DeleteSetButton.SetText("Delete");
            StyleButton(_DeleteSetButton);
            _SetChoiceView.Add(_DeleteSetButton);


            MeleeButton.Data   = TypeTab.MeleeTab;
            RangedButton.Data  = TypeTab.RangedTab;
            NaturalButton.Data = TypeTab.NaturalTab;

            foreach (var v in new GradientButton[] { MeleeButton, RangedButton, NaturalButton })
            {
                v.TouchUpInside += HandleTypeButtonClicked;
                v.StyleTab(false);
                v.Border = 2;
            }


            EditingView.Add(_ScrollView);
            EditingView.Add(_SetChoiceView);
            EditingView.Add(_SetControlView);

            _SetControlView.Add(_AddAttackButton);



            CMStyles.StyleBasicPanel(_SetChoiceView);
            CMStyles.StyleBasicPanel(_SetControlView);

            _SetChoiceView.CornerRadii = new float[]
            { _SetChoiceView.CornerRadius, _SetChoiceView.CornerRadius, 0, 0 };
            _SetControlView.CornerRadii = new float[]
            { 0, 0, _SetChoiceView.CornerRadius, _SetChoiceView.CornerRadius };


            _AddSetButton.TouchUpInside    += HandleAddSetButtonClicked;
            _DeleteSetButton.TouchUpInside += HandleDeleteSetClicked;



            _AddAttackPopover = new ButtonStringPopover(_AddAttackButton);
            _AddAttackPopover.WillShowPopover += HandleWillShowAddAttacksPopover;
            _AddAttackPopover.ItemClicked     += HandleAddAttackItemClicked;

            _SelectedTab = TypeTab.MeleeTab;
            MeleeButton.StyleTab(true);

            SetupMeleeTab();
            SetupAttackViews();
        }
        private void SetupManagers()
        {
            _HPManager     = new ButtonPropertyManager(HPButton, DialogParent, CurrentMonster, "HP");
            _HDManager     = new ButtonPropertyManager(HDButton, DialogParent, CurrentMonster.Adjuster, "HD");
            _HPModsManager = new ButtonPropertyManager(HPModsButton, DialogParent, CurrentMonster, "HP_Mods")
            {
                Title = "HP Mods"
            };


            _ACManager               = new ButtonPropertyManager(ACButton, DialogParent, CurrentMonster, "FullAC");
            _ACManager.Title         = "AC";
            _TouchManager            = new ButtonPropertyManager(TouchButton, DialogParent, CurrentMonster, "TouchAC");
            _TouchManager.Title      = "Touch AC";
            _FlatFootedManager       = new ButtonPropertyManager(FlatFootedButton, DialogParent, CurrentMonster, "FlatFootedAC");
            _FlatFootedManager.Title = "Flat Footed AC";

            _ArmorManager         = new ButtonPropertyManager(ArmorButton, DialogParent, CurrentMonster.Adjuster, "Armor");
            _DodgeManager         = new ButtonPropertyManager(DodgeButon, DialogParent, CurrentMonster.Adjuster, "Dodge");
            _NaturalManager       = new ButtonPropertyManager(NaturalButton, DialogParent, CurrentMonster.Adjuster, "NaturalArmor");
            _NaturalManager.Title = "Natural Armor";
            _DeflectionManager    = new ButtonPropertyManager(DeflectionButton, DialogParent, CurrentMonster.Adjuster, "Deflection");
            _ShieldManager        = new ButtonPropertyManager(ShieldButton, DialogParent, CurrentMonster.Adjuster, "Shield");

            _FortManager = new ButtonPropertyManager(FortButton, DialogParent, CurrentMonster, "Fort");
            _RefManager  = new ButtonPropertyManager(RefButton, DialogParent, CurrentMonster, "Ref");
            _WillManager = new ButtonPropertyManager(WillButton, DialogParent, CurrentMonster, "Will");

            _DefensiveAbilitiesManager = new ButtonPropertyManager(DefensiveAbilitiesButton, DialogParent, CurrentMonster, "DefensiveAbilities")
            {
                Title = "Defensive Abilities"
            };
            _DRManager       = new ButtonPropertyManager(DRButton, DialogParent, CurrentMonster, "DR");
            _ImmuneManager   = new ButtonPropertyManager(ImmuneButton, DialogParent, CurrentMonster, "Immune");
            _SRManager       = new ButtonPropertyManager(SRButton, DialogParent, CurrentMonster, "SR");
            _ResistManager   = new ButtonPropertyManager(ResistButton, DialogParent, CurrentMonster, "Resist");
            _WeaknessManager = new ButtonPropertyManager(WeaknessButton, DialogParent, CurrentMonster, "Weaknesses");

            PropertyManagers.Add(_HPManager);
            PropertyManagers.Add(_HDManager);
            PropertyManagers.Add(_HPModsManager);

            PropertyManagers.Add(_ACManager);
            PropertyManagers.Add(_TouchManager);
            PropertyManagers.Add(_FlatFootedManager);

            PropertyManagers.Add(_ArmorManager);
            PropertyManagers.Add(_DodgeManager);
            PropertyManagers.Add(_NaturalManager);
            PropertyManagers.Add(_DeflectionManager);
            PropertyManagers.Add(_ShieldManager);

            PropertyManagers.Add(_FortManager);
            PropertyManagers.Add(_RefManager);
            PropertyManagers.Add(_WillManager);

            PropertyManagers.Add(_DefensiveAbilitiesManager);
            PropertyManagers.Add(_DRManager);
            PropertyManagers.Add(_ImmuneManager);
            PropertyManagers.Add(_SRManager);
            PropertyManagers.Add(_ResistManager);
            PropertyManagers.Add(_WeaknessManager);

            foreach (ButtonPropertyManager m in PropertyManagers)
            {
                GradientButton b = (GradientButton)m.Button;
                CMStyles.TextFieldStyle(b);
            }
        }
        public TreasureGeneratorPage()
        {
            _SelectionView = new GradientView();
            _WebView       = new UIWebView();
            _EmailButton   = new GradientButton();
            _EmailButton.SetText("Email");
            _EmailButton.SetImage(UIExtensions.GetSmallIcon("mail"), UIControlState.Normal);
            _EmailButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 15);
            _EmailButton.TouchUpInside  += EmailButtonClicked;

            Add(_SelectionView);
            Add(_WebView);
            Add(_EmailButton);



            _LevelTab = new GradientButton();
            _LevelTab.SetText("Level");
            CMStyles.StyleTab(_LevelTab, true);
            _SelectionView.StyleBasicPanel();
            _SelectionView.Gradient     = new GradientHelper(CMUIColors.SecondaryColorADark);
            _SelectionView.CornerRadius = 0f;
            _LevelTab.TouchUpInside    += LevelTabClicked;

            _ItemsTab = new GradientButton();
            _ItemsTab.SetText("Items");
            CMStyles.StyleTab(_ItemsTab, false);
            _ItemsTab.TouchUpInside += ItemsTabClicked;


            _SelectionView.Add(_LevelTab);
            _SelectionView.Add(_ItemsTab);

            _LevelView = new GradientView();

            _ItemsView = new GradientView();

            foreach (var v in new GradientView[] { _LevelView, _ItemsView })
            {
                v.StyleBasicPanel();
                v.Gradient = new GradientHelper(CMUIColors.SecondaryColorADarker);
            }

            _ItemsView.Hidden = true;

            _SelectionView.Add(_LevelView);
            _SelectionView.Add(_ItemsView);

            _GenerateButton = new GradientButton();
            _GenerateButton.SetText("Generate");
            _GenerateButton.SetSmallIcon("treasure");
            _SelectionView.Add(_GenerateButton);
            _GenerateButton.TouchUpInside += GenerateButtonClicked;


            //create level items
            _LevelButton = new GradientButton();
            _LevelButton.SetText("Level 1");
            _LevelButton.Tag = 1;
            _LevelView.Add(_LevelButton);
            _LevelPopover = new ButtonStringPopover(_LevelButton);
            _LevelPopover.SetButtonText = true;
            _LevelPopover.ItemClicked  += HandleLevelPopoverItemClicked;

            for (int i = 1; i <= 20; i++)
            {
                _LevelPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = "Level " + i, Tag = i
                });
            }

            _CoinButton = new GradientButton();
            _CoinButton.SetText("Normal Coins");
            _LevelView.Add(_CoinButton);
            _CoinPopover = new ButtonStringPopover(_CoinButton);
            AddLevelPopoverItems(_CoinPopover, "Coins");
            _CoinButton.Tag = 1;

            _GoodsButton = new GradientButton();
            _GoodsButton.SetText("Normal Goods");
            _LevelView.Add(_GoodsButton);
            _GoodsPopover = new ButtonStringPopover(_GoodsButton);
            AddLevelPopoverItems(_GoodsPopover, "Goods");
            _GoodsButton.Tag = 1;

            _ItemsButton = new GradientButton();
            _ItemsButton.SetText("Normal Items");
            _ItemsPopover = new ButtonStringPopover(_ItemsButton);
            _LevelView.Add(_ItemsButton);
            _ItemsButton.Tag = 1;
            AddLevelPopoverItems(_ItemsPopover, "Items");

            //create item items
            _CountButton = new GradientButton();
            _CountButton.SetText("1 Item");
            _CountButton.Tag = 1;

            _ItemsView.Add(_CountButton);
            _CountPopover = new ButtonStringPopover(_CountButton);
            for (int i = 1; i < 61; i++)
            {
                string text = i + (i == 1?" Item":" Items");
                _CountPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = text, Tag = i
                });
            }
            _CountPopover.ItemClicked  += HandleLevelPopoverItemClicked;
            _CountPopover.SetButtonText = true;

            _ChartLevelButton = new GradientButton();
            _ChartLevelButton.SetText("Minor");
            _ChartLevelButton.Tag = 0;
            _ItemsView.Add(_ChartLevelButton);
            _ChartLevelPopover = new ButtonStringPopover(_ChartLevelButton);
            _ChartLevelPopover.SetButtonText = true;
            _ChartLevelPopover.ItemClicked  += HandleItemLevelClicked;;
            _ChartLevelPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "Minor", Tag = 0
            });
            _ChartLevelPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "Medium", Tag = 1
            });
            _ChartLevelPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "Major", Tag = 2
            });

            foreach (var t in new TreasureGenerator.RandomItemType [] {
                TreasureGenerator.RandomItemType.MagicalArmor,
                TreasureGenerator.RandomItemType.MagicalWeapon,
                TreasureGenerator.RandomItemType.Potion,
                TreasureGenerator.RandomItemType.Wand,
                TreasureGenerator.RandomItemType.Ring,
                TreasureGenerator.RandomItemType.Rod,
                TreasureGenerator.RandomItemType.Scroll,
                TreasureGenerator.RandomItemType.Staff,
                TreasureGenerator.RandomItemType.MinorWondrous,
            })
            {
                var b = new GradientButton();
                b.SetText(TreasureGenerator.RandomItemString(t));
                b.Tag = (int)t;
                b.MakeCheckButtonStyle(true);
                b.Data           = true;
                b.TouchUpInside += CheckButtonChecked;
                _ItemsView.Add(b);
                _ItemCheckButtons.Add(b);

                if (t == TreasureGenerator.RandomItemType.Rod)
                {
                    _RodButton         = b;
                    _RodButton.Enabled = false;
                }
                else if (t == TreasureGenerator.RandomItemType.Staff)
                {
                    _StaffButton         = b;
                    _StaffButton.Enabled = false;
                }
            }

            _SelectAllButton = new GradientButton();
            _SelectAllButton.SetText("Select All");
            _ItemsView.Add(_SelectAllButton);
            _SelectAllButton.TouchUpInside += SelectButtonClicked;
            _SelectAllButton.Data           = true;

            _UnselectAllButton = new GradientButton();
            _UnselectAllButton.SetText("Unselect All");
            _ItemsView.Add(_UnselectAllButton);
            _UnselectAllButton.TouchUpInside += SelectButtonClicked;
            _UnselectAllButton.Data           = false;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            StylePanel(this.AbilityArea);
            StylePanel(this.HeaderArea);

            _NameManager = new ButtonPropertyManager(NameButton, DialogParent, CurrentMonster, "Name");
            PropertyManagers.Add(_NameManager);

            _ClassManager = new ButtonPropertyManager(ClassButton, DialogParent, CurrentMonster, "Class");
            PropertyManagers.Add(_ClassManager);
            _SensesManager = new ButtonPropertyManager(SensesButton, DialogParent, CurrentMonster, "Senses");
            PropertyManagers.Add(_SensesManager);
            _RaceManager = new ButtonPropertyManager(RaceButton, DialogParent, CurrentMonster, "Race");
            PropertyManagers.Add(_RaceManager);
            _InitManager = new ButtonPropertyManager(InitButton, DialogParent, CurrentMonster, "Init");
            PropertyManagers.Add(_InitManager);
            _SubtypeManager       = new ButtonPropertyManager(CreatureSubtypeButton, DialogParent, CurrentMonster.Adjuster, "Subtype");
            _SubtypeManager.Title = "Subtype";
            PropertyManagers.Add(_SubtypeManager);


            _StatButtons.Add(Stat.Strength, StrengthButton);
            _StatButtons.Add(Stat.Dexterity, DexterityButton);
            _StatButtons.Add(Stat.Constitution, ConstitutionButton);
            _StatButtons.Add(Stat.Intelligence, IntelligenceButton);
            _StatButtons.Add(Stat.Charisma, CharismaButton);
            _StatButtons.Add(Stat.Wisdom, WisdomButton);

            foreach (KeyValuePair <Stat, UIButton> pair in _StatButtons)
            {
                ButtonPropertyManager m = new ButtonPropertyManager(pair.Value, DialogParent,
                                                                    CurrentMonster.Adjuster, Monster.StatText(pair.Key));
                m.MinIntValue    = 0;
                m.MaxIntValue    = 99;
                m.FormatDelegate = delegate(object num)
                {
                    string numText;
                    if (num == null)
                    {
                        numText = "-";
                    }
                    else
                    {
                        numText = ((int?)num).ToString();
                    }

                    numText += "  ";
                    numText += Monster.AbilityBonus((int?)num).PlusFormat();

                    return(numText);
                };
                _StatManagers[pair.Key] = m;
                PropertyManagers.Add(m);
            }

            _CRManager = new ButtonPropertyManager(CRButton, DialogParent, CurrentMonster.Adjuster, "CR");
            var crList = new List <KeyValuePair <object, string> >();


            crList.Add(new KeyValuePair <object, string>("1/8", "1/8"));
            crList.Add(new KeyValuePair <object, string>("1/6", "1/6"));
            crList.Add(new KeyValuePair <object, string>("1/4", "1/4"));
            crList.Add(new KeyValuePair <object, string>("1/3", "1/3"));
            crList.Add(new KeyValuePair <object, string>("1/2", "1/2"));
            for (int i = 1; i < 31; i++)
            {
                crList.Add(new KeyValuePair <object, string>(i.ToString(), i.ToString()));
            }

            _CRManager.ValueList = crList;
            PropertyManagers.Add(_CRManager);

            _AlignmentManager = new ButtonPropertyManager(AlignmentButton, DialogParent, CurrentMonster, "Alignment");
            PropertyManagers.Add(_AlignmentManager);

            var alignmentList = new List <KeyValuePair <object, string> >();

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    string al = Monster.AlignmentText(
                        new Monster.AlignmentType()
                    {
                        Order = (Monster.OrderAxis)i, Moral = (Monster.MoralAxis)j
                    });

                    alignmentList.Add(new KeyValuePair <object, string>(al, al));
                }
            }
            _AlignmentManager.ValueList = alignmentList;


            _CreatureTypeManager = new ButtonPropertyManager(CreatureTypeButton, DialogParent, CurrentMonster, "Type");
            PropertyManagers.Add(_CreatureTypeManager);
            var typeList = new List <KeyValuePair <object, string> >();

            foreach (CreatureType t in Enum.GetValues(typeof(CreatureType)))
            {
                string name = Monster.CreatureTypeNames[(int)t];

                typeList.Add(new KeyValuePair <object, string>(name, name.Capitalize()));
            }
            _CreatureTypeManager.ValueList = typeList;

            _CreatureSizeManager = new ButtonPropertyManager(SizeButton, DialogParent, CurrentMonster.Adjuster, "MonsterSize");
            PropertyManagers.Add(_CreatureSizeManager);
            var sizeList = new List <KeyValuePair <object, string> >();

            foreach (MonsterSize s in Enum.GetValues(typeof(MonsterSize)))
            {
                string name = SizeMods.GetSizeText(s);


                sizeList.Add(new KeyValuePair <object, string>((int)s, name));
            }
            _CreatureSizeManager.FormatDelegate = delegate(object s)
            {
                return(SizeMods.GetSizeText((MonsterSize)s));
            };
            _CreatureSizeManager.ValueList = sizeList;

            foreach (ButtonPropertyManager m in PropertyManagers)
            {
                GradientButton b = m.Button as GradientButton;

                CMStyles.TextFieldStyle(b);
            }
        }
예제 #11
0
        public DieRollerView()
        {
            Roller = this;

            BackgroundColor = CMUIColors.PrimaryColorDark;
            ClipsToBounds   = true;


            _TitleButton = new GradientButton();
            _TitleButton.SetText("Die Roller");
            _TitleButton.Font           = UIFont.BoldSystemFontOfSize(17);
            _TitleButton.CornerRadius   = 0;
            _TitleButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                Collapsed = !Collapsed;
            };


            _OutputView = new UIWebView();

            _RollButton = new GradientButton();
            _RollButton.TouchUpInside += RollButtonClicked;
            _RollButton.SetText("Roll");
            _RollButton.SetImage(UIExtensions.GetSmallIcon("dice"), UIControlState.Normal);
            _RollButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 7);
            _RollButton.CornerRadius    = 0;
            _RollButton.Gradient        = new GradientHelper(CMUIColors.SecondaryColorADarker, CMUIColors.SecondaryColorADark);
            _RollButton.Font            = UIFont.BoldSystemFontOfSize(17);

            _ClearButton = new GradientButton();
            _ClearButton.TouchUpInside += ClearButtonClicked;
            _ClearButton.SetText("Clear");
            _ClearButton.CornerRadius = 0;
            _ClearButton.Font         = UIFont.BoldSystemFontOfSize(17);
            _ClearButton.Gradient     = new GradientHelper(CMUIColors.SecondaryColorBDarker, CMUIColors.SecondaryColorBDark);

            _ClearHtmlButton = new GradientButton();
            _ClearHtmlButton.TouchUpInside += _ClearHtmlButtonClicked;
            _ClearHtmlButton.SetText("Reset");
            _ClearHtmlButton.SetImage(UIExtensions.GetSmallIcon("reset"), UIControlState.Normal);
            _ClearHtmlButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 7);
            _ClearHtmlButton.Font            = UIFont.BoldSystemFontOfSize(17);
            _ClearHtmlButton.CornerRadius    = 0;
            _ClearHtmlButton.Gradient        = new GradientHelper(CMUIColors.SecondaryColorADarker, CMUIColors.SecondaryColorADark);

            _BottomView = new GradientView();
            _BottomView.ClipsToBounds = true;
            _BottomView.Gradient      = new GradientHelper(CMUIColors.PrimaryColorDarker);

            Add(_TitleButton);
            Add(_OutputView);
            Add(_BottomView);
            Add(_ClearHtmlButton);

            _BottomView.AddSubviews(_RollButton, _ClearButton);

            BringSubviewToFront(_BottomView);

            _DieButtons = new List <UIButton>();

            foreach (var v in new int [] { 4, 6, 8, 10, 12, 20, 100 })
            {
                GradientButton b = new GradientButton();
                b.CornerRadius = 0;
                b.SetText(v.ToString());
                b.Tag            = v;
                b.TouchUpInside += DieClicked;

                UIImage im = null;

                switch (v)
                {
                case 4:
                case 6:
                case 8:
                case 10:
                case 12:
                case 100:
                    im = UIExtensions.GetSmallIcon("d" + v);
                    break;

                case 20:
                    im = UIExtensions.GetSmallIcon("d20p");
                    break;
                }

                if (im != null)
                {
                    b.BonusImage        = im;
                    b.ContentEdgeInsets = new UIEdgeInsets(25, 0, 0, 0);
                }


                _BottomView.AddSubview(b);
                _DieButtons.Add(b);

                UISwipeGestureRecognizer rec = new UISwipeGestureRecognizer();
                rec.Direction = UISwipeGestureRecognizerDirection.Up | UISwipeGestureRecognizerDirection.Down;
                rec.Delegate  = new SwipeGestureDelegate();
                rec.AddTarget(this, new ObjCRuntime.Selector("HandleDieSwipe:"));
                _Recs[rec] = b;

                b.AddGestureRecognizer(rec);
            }

            _DieTextButton = new GradientButton();
            CMStyles.TextFieldStyle(_DieTextButton);
            _BottomView.Add(_DieTextButton);
            _DieTextButton.TouchUpInside += DieTextButtonClicked;
            _DieTextButton.TitleLabel.AdjustsFontSizeToFitWidth = true;
            BringSubviewToFront(_TitleButton);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _AreaViews = new List <GradientView>()
            {
                BaseView, ModView, DescriptionView, SkillsView
            };
            foreach (GradientView v in _AreaViews)
            {
                StylePanel(v);
            }



            ButtonPropertyManager pm;

            pm = new ButtonPropertyManager(BaseAtkButton, DialogParent, CurrentMonster, "BaseAtk")
            {
                Title = "Base Attack Bonus"
            };
            _Managers.Add(pm);
            pm = new ButtonPropertyManager(CMBButton, DialogParent, CurrentMonster, "CMB_Numeric")
            {
                Title = "CMD"
            };
            _Managers.Add(pm);
            pm = new ButtonPropertyManager(CMDButton, DialogParent, CurrentMonster, "CMD_Numeric")
            {
                Title = "CMB"
            };
            _Managers.Add(pm);
            pm = new ButtonPropertyManager(RacialModsButton, DialogParent, CurrentMonster, "RacialMods");
            _Managers.Add(pm);
            pm = new ButtonPropertyManager(AuraButton, DialogParent, CurrentMonster, "Aura");
            _Managers.Add(pm);
            pm = new ButtonPropertyManager(SQButton, DialogParent, CurrentMonster, "SQ")
            {
                Multiline = true, Title = "Special Qualities"
            };
            _Managers.Add(pm);
            pm = new ButtonPropertyManager(LanguagesButton, DialogParent, CurrentMonster, "Languages")
            {
                Multiline = true
            };
            _Managers.Add(pm);
            pm = new ButtonPropertyManager(GearButton, DialogParent, CurrentMonster, "Gear")
            {
                Multiline = true
            };
            _Managers.Add(pm);

            CMStyles.TextFieldStyle(SkillDetailButton);
            SkillDetailButton.TouchUpInside += HandleSkillDetailClicked;

            _SkillDetailPopover = new ButtonStringPopover(SkillDetailSelectButton);
            _SkillDetailPopover.WillShowPopover += HandleWillShowDetailPopover;
            _SkillDetailPopover.ItemClicked     += HandleSkillDetailItemClicked;


            SkillDetailSelectButton.SetImage(UIExtensions.GetSmallIcon("prev"), UIControlState.Normal);

            foreach (GradientButton b in from x in _Managers select x.Button)
            {
                CMStyles.TextFieldStyle(b, 15f);
            }

            AvailableSkillsTable.DataSource = new AvailableViewDataSource(this);
            AvailableSkillsTable.Delegate   = new AvailableViewDelegate(this);
            AvailableSkillsTable.RowHeight  = 24;

            KnownSkillsTable.DataSource = new KnownViewDataSource(this);
            KnownSkillsTable.Delegate   = new KnownViewDelegate(this);
            KnownSkillsTable.RowHeight  = 24;

            UpdateSelectableSkills();

            AddSkillButton.TouchUpInside += AddSkillButtonClicked;
        }
예제 #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            foreach (GradientView v in new GradientView[] { SpeedView, AttacksView, AbilitiesView })
            {
                StylePanel(v);
            }

            CurrentMonster.Adjuster.PropertyChanged += MonsterAdjusterPropertyChanged;

            ButtonPropertyManager m;

            m = new ButtonPropertyManager(SpeedButton, DialogParent, CurrentMonster.Adjuster, "LandSpeed")
            {
                Title = "Land Speed", MinIntValue = 0
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(ClimbButton, DialogParent, CurrentMonster.Adjuster, "ClimbSpeed")
            {
                Title = "Climb Speed", MinIntValue = 0
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(SpaceButton, DialogParent, CurrentMonster.Adjuster, "Space")
            {
                Title = "Space"
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(FlyButton, DialogParent, CurrentMonster.Adjuster, "FlySpeed")
            {
                Title = "Fly Speed", MinIntValue = 0
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(BurrowButton, DialogParent, CurrentMonster.Adjuster, "BurrowSpeed")
            {
                Title = "Burrow Speed", MinIntValue = 0
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(ReachButton, DialogParent, CurrentMonster.Adjuster, "Reach")
            {
                Title = "Reach"
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(FlyQualityButton, DialogParent, CurrentMonster.Adjuster, "FlyQuality")
            {
                Title = "Fly Quality"
            };

            var list = new List <KeyValuePair <object, string> >();

            for (int i = 0; i < 5; i++)
            {
                list.Add(new KeyValuePair <object, string>(i, Monster.GetFlyQualityString(i).Capitalize()));
            }
            m.ValueList      = list;
            m.FormatDelegate = a =>
            {
                if (CurrentMonster.Adjuster.FlySpeed == null)
                {
                    return("-");
                }
                else
                {
                    return(Monster.GetFlyQualityString((int)a).Capitalize());
                }
            };
            _Managers.Add(m);

            m = new ButtonPropertyManager(SwimButton, DialogParent, CurrentMonster.Adjuster, "SwimSpeed")
            {
                Title = "Swim Speed"
            };
            _Managers.Add(m);


            m = new ButtonPropertyManager(SpecialAttacksButton, DialogParent, CurrentMonster, "SpecialAttacks")
            {
                Title = "Special Attacks", Multiline = true
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(SpellLikeAbilitiesButton, DialogParent, CurrentMonster.Adjuster, "SpellLikeAbilities")
            {
                Title = "Spell-Like Abilities", Multiline = true
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(SpellsKnownButton, DialogParent, CurrentMonster.Adjuster, "SpellsKnown")
            {
                Title = "Spells Known", Multiline = true
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(SpellsPreparedButton, DialogParent, CurrentMonster.Adjuster, "SpellsPrepared")
            {
                Title = "SpellsPrepared", Multiline = true
            };
            _Managers.Add(m);

            m = new ButtonPropertyManager(MeleeButton, DialogParent, CurrentMonster, "Melee")
            {
                Title = "Melee", Multiline = true
            };
            _Managers.Add(m);
            m = new ButtonPropertyManager(RangedButton, DialogParent, CurrentMonster, "Ranged")
            {
                Title = "Ranged", Multiline = true
            };
            _Managers.Add(m);


            foreach (GradientButton b in from x in _Managers select x.Button)
            {
                CMStyles.TextFieldStyle(b, 15f);
            }

            AttacksEditorButton.TouchUpInside += (sender, e) =>
            {
                _AEDialog            = new AttacksEditorDialog(CurrentMonster);
                _AEDialog.OKClicked += (senderx, e1) =>
                {
                    CharacterAttacks at = _AEDialog.Attacks;
                    CurrentMonster.Melee  = CurrentMonster.MeleeString(at);
                    CurrentMonster.Ranged = CurrentMonster.RangedString(at);
                };
                DialogParent.Add(_AEDialog.View);
            };

            UpdateButtonState();
        }