public override void ViewDidLoad() { base.ViewDidLoad(); NameLabel.Text = _WeaponItem.Name.Capitalize(); SpecialButton.SetText(_WeaponItem.SpecialAbilities); SpecialButton.SetTitleColor(UIColor.White, UIControlState.Normal); _SpecialPopover = new ButtonStringPopover(SpecialButton); _SpecialPopover.ItemClicked += HandleSpecialItemClicked; _SpecialPopover.WillShowPopover += HandleWillShowBonusPopover; BonusButton.SetText(BonusText); BonusButton.SetTitleColor(UIColor.White, UIControlState.Normal); _BonusPopover = new ButtonStringPopover(BonusButton); _BonusPopover.WillShowPopover += HandleWillShowBonus; _BonusPopover.ItemClicked += HandleBonusItemClicked; DeleteButton.Gradient = new GradientHelper(0x00000000.UIColor()); DeleteButton.Border = 0; DeleteButton.SetImage(UIImage.FromFile("Images/External/redx.png"), UIControlState.Normal); DeleteButton.TouchUpInside += DeleteButtonClicked; ((GradientView)View).StyleBasicPanel(); NameView.BackgroundColor = 0x0.UIColor(); NameView.Gradient = new GradientHelper(CMUIColors.SecondaryColorBDarker); HandView.BackgroundColor = 0x0.UIColor(); HandView.Gradient = new GradientHelper(CMUIColors.SecondaryColorADarker); HandLabel.Text = _WeaponItem.Weapon.HandsUsed + " Hand" + (_WeaponItem.Weapon.HandsUsed != 1?"s":""); EnableButtons(); }
void HandleSpecialItemClicked(object sender, ButtonStringPopover.PopoverEventArgs e) { var v = (Tuple <bool, WeaponSpecialAbility>)e.Tag; if (v.Item1) { _WeaponItem.SpecialAbilitySet.Remove(v.Item2.Name); } else { _WeaponItem.SpecialAbilitySet.Add(v.Item2.Name, v.Item2.Name); } _WeaponItem.SpecialAbilitySet = _WeaponItem.SpecialAbilitySet; SpecialButton.SetText(_WeaponItem.SpecialAbilities); }
void HandleBonusItemClicked(object sender, ButtonStringPopover.PopoverEventArgs e) { if (e.Tag == null) { _WeaponItem.MagicBonus = 0; _WeaponItem.Masterwork = true; _WeaponItem.SpecialAbilities = ""; } else { int bonus = (int)e.Tag; _WeaponItem.Masterwork = false; _WeaponItem.MagicBonus = bonus; if (bonus == 0) { _WeaponItem.SpecialAbilities = ""; } } BonusButton.SetText(BonusText); SpecialButton.SetText(_WeaponItem.SpecialAbilities); EnableButtons(); }