void Handle_ActionsPopoverItemClicked(object sender, ButtonStringPopover.PopoverEventArgs e) { CharacterActionItem item = (CharacterActionItem)e.Tag; if (item.Action != CharacterActionType.None) { CharacterActionResult res = CharacterActions.TakeAction(_CombatState, item.Action, _Character, new List <Character>() { _Character }, item.Tag); switch (res) { case CharacterActionResult.NeedConditionDialog: _ConditionView = new ConditionViewController(); _ConditionView.ConditionApplied += ConditionApplied; MainUI.MainView.AddSubview(_ConditionView.View); break; case CharacterActionResult.NeedNotesDialog: _TextBoxDialog = new TextBoxDialog(); _TextBoxDialog.HeaderText = "Notes"; _TextBoxDialog.Value = _Character.Notes; MainUI.MainView.AddSubview(_TextBoxDialog.View); _TextBoxDialog.OKClicked += Handle_NotesTextBoxDialogOKClicked; break; case CharacterActionResult.NeedMonsterEditorDialog: Monster newMonster = (Monster)Character.Monster.Clone(); _MonsterEditorDialog = new MonsterEditorDialog(newMonster); _MonsterEditorDialog.MonsterEditorComplete += (sd, monster) => { Character.Monster.CopyFrom(newMonster); }; MainUI.MainView.AddSubview(_MonsterEditorDialog.View); break; case CharacterActionResult.RollAttack: DieRollerView.Roller.RollAttack((Attack)item.Tag, _Character); break; case CharacterActionResult.RollAttackSet: DieRollerView.Roller.RollAttackSet((AttackSet)item.Tag, _Character); break; case CharacterActionResult.RollSave: DieRollerView.Roller.RollSave((Monster.SaveType)item.Tag, _Character); break; case CharacterActionResult.RollSkill: var sks = (Tuple <string, string>)item.Tag; DieRollerView.Roller.RollSkill(sks.Item1, sks.Item2, _Character); break; } } }
void UpdateConditionDisplay() { if (View != null) { foreach (GradientButton b in ConditionButtons) { b.RemoveFromSuperview(); } ConditionButtons.Clear(); float xLoc = ConditionMargin; float yLoc = 79 + ConditionMargin; foreach (ActiveCondition c in _Character.Monster.ActiveConditions) { GradientButton b = new GradientButton(); b.Frame = new CGRect(xLoc, yLoc, ConditionWidth, ConditionHeight); b.SetImage(UIExtensions.GetSmallIcon(c.Condition.Image), UIControlState.Normal); View.AddSubview(b); if (c.Turns != null) { b.SetText(c.Turns.ToString()); } b.Data = c; c.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Turns") { string text = ""; if (c.Turns != null) { text = c.Turns.ToString(); } b.SetText(text); b.TitleLabel.AdjustsFontSizeToFitWidth = true; } }; ButtonStringPopover p = new ButtonStringPopover(b); BuildConditionMenu(p, c); xLoc += ConditionWidth + ConditionMargin; if (xLoc + ConditionWidth > View.Bounds.Width) { xLoc = ConditionMargin; yLoc += ConditionHeight + ConditionMargin; } UIWebView v = new UIWebView(new CGRect(0, 0, 300, 300)); v.LoadHtmlString(ConditionViewController.ConditionHTML(c.Condition), new NSUrl("http://localhost/")); p.AccessoryView = v; } } }
public ViewDelegate(ConditionViewController state) { this.state = state; }
public ViewDataSource(ConditionViewController state) { this.state = state; }