Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
 public void MoveToSubItems(CharacterActionItem ai)
 {
     if (_ActionItems != null)
     {
         _ParentActionItems.Push(_ActionItems);
     }
     _ActionItems = ai.SubItems;
 }
Ejemplo n.º 3
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;
                }
            }
        }
Ejemplo n.º 4
0
            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);
                }
            }
Ejemplo n.º 5
0
    void Awake()
    {
        string actionConfig = C_Singleton <GameResMgr> .GetInstance().LoadString("action_config", "entity", "character", "c_framework/entity/character/" + Name + "/config/");

        if (!string.IsNullOrEmpty(actionConfig))
        {
            JsonData actionJD = C_Json.GetJsonKeyJsonData(actionConfig, "Acton");
            if (actionJD != null)
            {
                for (int i = 0; i < actionJD.Count; i++)
                {
                    CharacterAction action = new CharacterAction();
                    action.Name         = C_Json.GetJsonKeyString(actionJD[i], "Name");
                    action.Type         = C_Json.GetJsonKeyInt(actionJD[i], "Type");
                    action.EndType      = C_Json.GetJsonKeyInt(actionJD[i], "EndType");
                    action.DurationTime = C_Json.GetJsonKeyFloat(actionJD[i], "DurationTime");

                    JsonData animatorControllerJD = C_Json.GetJsonKeyJsonData(actionJD[i], "AnimatorController");
                    if (animatorControllerJD != null)
                    {
                        for (int j = 0; j < animatorControllerJD.Count; j++)
                        {
                            CharacterActionItem item = new CharacterActionItem();
                            item.Name         = C_Json.GetJsonKeyString(animatorControllerJD[j], "Name");
                            item.Type         = C_Json.GetJsonKeyInt(animatorControllerJD[j], "Type");
                            item.DurationTime = C_Json.GetJsonKeyFloat(animatorControllerJD[j], "DurationTime");
                            action.AnimatorController.Add(item);
                        }
                    }

                    JsonData audioJD = C_Json.GetJsonKeyJsonData(actionJD[i], "Audio");
                    if (audioJD != null)
                    {
                        for (int j = 0; j < audioJD.Count; j++)
                        {
                            CharacterActionItem item = new CharacterActionItem();
                            item.Name         = C_Json.GetJsonKeyString(audioJD[j], "Name");
                            item.Type         = C_Json.GetJsonKeyInt(audioJD[j], "Type");
                            item.DurationTime = C_Json.GetJsonKeyFloat(audioJD[j], "DurationTime");
                            action.Audio.Add(item);
                        }
                    }

                    m_CharacterAction.Add(action);
                }
            }
        }
    }
Ejemplo n.º 6
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            CharacterActionItem ai = _ActionItems[position];
            TextView            t  = (TextView)convertView;

            if (t == null)
            {
                t = new TextView(_Context);
            }
            t.Text = ai.Name;
            t.SetTextColor(new Color(0xee, 0xee, 0xee));
            t.SetTextSize(Android.Util.ComplexUnitType.Dip, 20f);
            if (ai.Name != null && ai.Name.Length > 0)
            {
                t.SetPadding(8, 10, 5, 10);
            }
            else
            {
                t.SetPadding(0, -2, 0, -2);
                t.Enabled = false;
            }
            t.SetCompoundDrawablesWithIntrinsicBounds(PopupUtils.NamedImage(_Context, ai.Icon), null, null, null);
            return(t);
        }