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 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);
            }
        }