void HandleWillShowBonusPopover(object sender, WillShowPopoverEventArgs e) { _SpecialPopover.Items.Clear(); List <Tuple <bool, WeaponSpecialAbility> > list = new List <Tuple <bool, WeaponSpecialAbility> >(); if (_WeaponItem.Weapon.Ranged) { foreach (WeaponSpecialAbility ability in WeaponSpecialAbility.RangedAbilities) { bool contains = false; if (_WeaponItem.SpecialAbilitySet.ContainsKey(ability.Name)) { contains = true; } else if (ability.AltName != null && ability.AltName.Length > 0 && _WeaponItem.SpecialAbilitySet.ContainsKey(ability.AltName)) { contains = true; } list.Add(new Tuple <bool, WeaponSpecialAbility>(contains, ability)); } } else { foreach (WeaponSpecialAbility ability in WeaponSpecialAbility.MeleeAbilities) { bool contains = false; if (_WeaponItem.SpecialAbilitySet.ContainsKey(ability.Name)) { contains = true; } else if (ability.AltName != null && ability.AltName.Length > 0 && _WeaponItem.SpecialAbilitySet.ContainsKey(ability.AltName)) { contains = true; } list.Add(new Tuple <bool, WeaponSpecialAbility>(contains, ability)); } } list.Sort((a, b) => a.Item2.Name.CompareTo(b.Item2.Name)); foreach (var v in list) { _SpecialPopover.Items.Add(new ButtonStringPopoverItem() { Text = v.Item2.Name, Tag = v, Icon = v.Item1?"check":null }); } }
void Handle_ValueListWillShowPopover(object sender, WillShowPopoverEventArgs e) { if (StringList) { List <String> values = ((String)Value).Tokenize(','); foreach (ButtonStringPopoverItem item in _ValueListPopover.Items) { item.Selected = values.Contains((string)item.Tag); } } }
void HandleWillShowAttackPopover(object sender, WillShowPopoverEventArgs e) { if (_AttackPopover.Items.Count == 0) { foreach (var r in from w in Weapon.Weapons where w.Value.Natural orderby w.Value.Name ascending select w.Value) { _AttackPopover.Items.Add(new ButtonStringPopoverItem() { Text = r.Name, Tag = r }); } } }
void HandleWillShowOtherPopover(object sender, WillShowPopoverEventArgs e) { ButtonStringPopover popover = (ButtonStringPopover)sender; int item = (int)popover.Data; popover.Items.Clear(); switch (template) { case AdvancerTemplate.Skeleton: e.Cancel = true; _SelectedSkeletonTypes[item] = !_SelectedSkeletonTypes[item]; HandleChange(); break; case AdvancerTemplate.Zombie: popover.Items.Add(new ButtonStringPopoverItem() { Text = ZombieText(Monster.ZombieType.Normal, false), Tag = Monster.ZombieType.Normal }); popover.Items.Add(new ButtonStringPopoverItem() { Text = ZombieText(Monster.ZombieType.Fast, false), Tag = Monster.ZombieType.Fast }); popover.Items.Add(new ButtonStringPopoverItem() { Text = ZombieText(Monster.ZombieType.Plague, false), Tag = Monster.ZombieType.Plague }); break; case AdvancerTemplate.HalfDragon: foreach (string s in Monster.DragonColors) { popover.Items.Add(new ButtonStringPopoverItem() { Text = s.Capitalize(), Tag = s }); } break; case AdvancerTemplate.HalfCelestial: case AdvancerTemplate.HalfFiend: e.Cancel = true; _SelectedStats[item] = !_SelectedStats[item]; HandleChange(); break; } }
void HandleWillShowDamagePopover(object sender, WillShowPopoverEventArgs e) { if (_DamagePopover.Items.Count == 0) { DieStep die = new DieStep(0, 1); for (int i = 0; i < 11; i++) { _DamagePopover.Items.Add(new ButtonStringPopoverItem() { Text = die.Text, Tag = die }); DieRoll roll = new DieRoll(die.Count, die.Die, 0); roll = DieRoll.StepDie(roll, 1); die = roll.Step; } } }
void HandleBTouchUpInside(object sender, EventArgs e) { WillShowPopoverEventArgs ea = new WillShowPopoverEventArgs(); if (WillShowPopover != null) { WillShowPopover(this, ea); } _CurrentItems = _Items; RecalcHeight(); if (!ea.Cancel) { _controller.PresentFromRect(_button.Frame, _button.Superview, UIPopoverArrowDirection.Any, true); TableView.ReloadData(); } }
void HandleWillShowDetailPopover(object sender, WillShowPopoverEventArgs e) { if (_SelectedSkill.IsEmptyOrNull()) { e.Cancel = true; } else { _SkillDetailPopover.Items.Clear(); Monster.SkillInfo det = Monster.SkillsDetails[_SelectedSkill]; foreach (var v in det.Subtypes) { _SkillDetailPopover.Items.Add(new ButtonStringPopoverItem() { Text = v, Tag = v }); } } }
void HandleWillShowAddAttacksPopover(object sender, WillShowPopoverEventArgs e) { bool ranged = _SelectedTab == TypeTab.RangedTab; bool melee = _SelectedTab == TypeTab.MeleeTab; int handsAvailable = melee?_Attacks.Hands - CountHands(_VisibleSet):0; _AddAttackPopover.Items.Clear(); foreach (Weapon w in from x in Weapon.Weapons.Values where (x.HandsUsed <= handsAvailable || ranged) && x.Ranged == ranged orderby x.Name select x) { _AddAttackPopover.Items.Add(new ButtonStringPopoverItem() { Text = (w.Name + " " + w.DamageText).Capitalize(), Tag = w }); } }
void HandleWillShowBonus(object sender, WillShowPopoverEventArgs e) { _BonusPopover.Items.Clear(); _BonusPopover.Items.Add(new ButtonStringPopoverItem() { Text = "-", Tag = 0 }); _BonusPopover.Items.Add(new ButtonStringPopoverItem() { Text = "mwk", Tag = null }); for (int i = 1; i < 6; i++) { _BonusPopover.Items.Add(new ButtonStringPopoverItem() { Text = i.PlusFormat(), Tag = i }); } }