void Handle_DiePopModified(object sender, NumberModifyEventArgs args) { DieStep step = state._DieSteps[lastSelectedIndex]; step.Die = args.ModifyValue(step.Die, 0, int.MaxValue).Value; state.UpdateDieRoll(); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("HDEditorDialogCell"); if (cell == null) { cell = new DataListViewCell(UITableViewCellStyle.Default, "HDEditorDialogCell"); } DieStep step = state._DieSteps[indexPath.Row]; UIView buttonView = new UIView(new CGRect(0, 0, bWidth * 4 + 1, bHeight)); GradientButton b = new GradientButton(); b.SetText(step.Count.ToString()); StyleButton(b); b.Frame = new CGRect(0, 0, bWidth, bHeight); b.TouchUpInside += HandleCountTouchUpInside; b.Tag = indexPath.Row; buttonView.AddSubview(b); UILabel l = new UILabel(new CGRect(bWidth, 0, bWidth, bHeight)); l.Text = "d"; l.TextAlignment = UITextAlignment.Center; l.BackgroundColor = UIColor.Clear; buttonView.AddSubview(l); b = new GradientButton(); b.SetText(step.Die.ToString()); StyleButton(b); b.Frame = new CGRect(bWidth * 2, 0, bWidth, bHeight); b.TouchUpInside += HandleDieTouchUpInside; b.Tag = indexPath.Row; buttonView.AddSubview(b); b = new GradientButton(); b.SetImage(UIExtensions.GetSmallIcon("delete"), UIControlState.Normal); StyleButton(b); b.Frame = new CGRect(bWidth * 3, 0, bWidth + 1, bHeight); buttonView.AddSubview(b); b.Tag = indexPath.Row; b.TouchUpInside += HandleDeleteTouchUpInside; cell.AccessoryView = buttonView; cell.Data = state._DieSteps[indexPath.Row]; //cell.TextLabel.Text = state._DieSteps.ToString(); return(cell); }
public static RemoteDie ToRemote(this DieStep step) { if (step == null) { return(null); } RemoteDie die = new RemoteDie(); die.Die = step.Die; die.Count = step.Count; return(die); }
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(); }
void HandleDieTouchUpInside(object sender, EventArgs e) { int index = (int)((UIButton)sender).Tag; lastSelectedIndex = index; DieStep step = state._DieSteps[index]; state._NumberPop = new NumberModifyPopover(); state._NumberPop.Title = "Die"; state._NumberPop.Data = "Die"; state._NumberPop.Value = step.Die; state._NumberPop.ShowOnView((UIButton)sender); state._NumberPop.NumberModified += Handle_DiePopModified; }
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 Handle_AddDiePopoverItemClicked(object sender, ButtonStringPopover.PopoverEventArgs e) { int die = (int)e.Tag; bool found = false; foreach (DieStep step in _DieSteps) { if (step.Die == die) { step.Count++; found = true; break; } } if (!found) { DieStep step = new DieStep(1, die); _DieSteps.Add(step); } UpdateDieRoll(); }