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 ListViewItemClick(object sender, AdapterView.ItemClickEventArgs e) { ListView lv = (ListView)FindViewById(Resource.Id.actionListView); CharacterActionsAdapter ca = (CharacterActionsAdapter)lv.Adapter; CharacterActionItem ai = ca.ActionItems[e.Position]; if (ai.SubItems != null) { ca.MoveToSubItems(ai); ca.NotifyDataSetChanged(); } else if (ai.Name != null && ai.Name.Length > 0) { CharacterActionResult res = CharacterActions.TakeAction(_State, ai.Action, _Character, new List <CombatManager.Character>() { _Character }, ai.Tag); Dismiss(); switch (res) { case CharacterActionResult.NeedAttacksDialog: break; case CharacterActionResult.NeedMonsterEditorDialog: ShowMonsterEditor(); break; case CharacterActionResult.NeedConditionDialog: ShowConditionDialog(); break; case CharacterActionResult.NeedNotesDialog: ShowNotesDialog(); break; case CharacterActionResult.RollAttack: _State.Roll(CombatState.RollType.Attack, _Character, (Attack)ai.Tag, null); break; case CharacterActionResult.RollAttackSet: _State.Roll(CombatState.RollType.AttackSet, _Character, (AttackSet)ai.Tag, null); break; case CharacterActionResult.RollSave: _State.Roll(CombatState.RollType.Save, _Character, (Monster.SaveType)ai.Tag, null); break; case CharacterActionResult.RollSkill: var sks = (Tuple <string, string>)ai.Tag; _State.Roll(CombatState.RollType.Skill, _Character, sks.Item1, sks.Item2); break; } } }
void HandleActionsPopoverItemClicked(object sender, ButtonStringPopover.PopoverEventArgs e) { Character ch = (Character)((ButtonStringPopover)sender).Data; CharacterActionItem item = (CharacterActionItem)e.Tag; if (item.Action != CharacterActionType.None) { CharacterActions.TakeAction(state._CombatState, item.Action, ch, new List <Character>() { ch }, item.Tag); } }