void HandleDamageItemClicked(object sender, ButtonStringPopover.PopoverEventArgs e) { DieStep die = (DieStep)e.Tag; _WeaponItem.Step = new DieStep(die.Count, die.Die); DieStep step = DieRoll.StepDie(_WeaponItem.Weapon.DamageDie.Step, -SizeMods.StepsFromMedium(SizeMods.GetSize(_Monster.Size))); _WeaponItem.Weapon.DmgM = step.Text; _WeaponItem.Weapon.DmgS = DieRoll.StepDie(step, -1).Text; UpdateWeaponDamageText(); }
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); } }