コード例 #1
0
        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;
                }
            }
        }