Exemplo n.º 1
0
    public bool GetBattleAction_BattleTalk(CharacterLogic chLogic, ref IActionMenu.UIActionButtonInfo info)
    {
        //找到临近的4个单位的id
        var center           = chLogic.GetTileCoord();
        var sidewayCharacter = chapterManager.GetSidewayCharacter(center);
        List <BattleTalkEventActionInfo> talkEvents = new List <BattleTalkEventActionInfo>();

        foreach (var v in sidewayCharacter)
        {
            var t = chapterManager.Event.EventInfo.GetBattleTalkEvent(chLogic.GetID(), v.Logic.GetID());
            if (t != null)
            {
                talkEvents.Add(new BattleTalkEventActionInfo(v.Logic, t));
            }
        }
        if (talkEvents.Count == 0)
        {
            Debug.Log("没有Talk事件");
            return(false);
        }
        Debug.Log("找到相匹配的Tald Event" + Utils.TextUtil.GetListString(talkEvents));

        info.name   = talkEvents[0].Event.GetButtonText();
        info.action = () =>
        {
            HideBattlaActionMenu(false);
            //进入选择Target阶段,然后将TalkEvents和坐标一并传入到BattleManager里面的SelectTarget阶段。
            //点击选择后执行绑定后的动作
            battleManager.SelectTalkCharacter(talkEvents);
        };
        info.enable = chLogic.IsActionEnable(EnumActionType.Talk);
        return(true);
    }
Exemplo n.º 2
0
    public void ShowBattleMainMenu()
    {
        BattleMainMenu.Clear();
        var endTurn = new IActionMenu.UIActionButtonInfo("结束行动", EndPlayerTurn);

        BattleMainMenu.AddAction(endTurn);
        BattleMainMenu.Show();
    }
Exemplo n.º 3
0
 public bool CheckBattleTalkEvent(CharacterLogic chLogic)
 {
     IActionMenu.UIActionButtonInfo location = new IActionMenu.UIActionButtonInfo();
     if (GetBattleAction_BattleTalk(chLogic, ref location))
     {
         BattleActionMenu.AddAction(location);
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
    public void BuildBattleSelectWeaponMenu(CharacterLogic chLogic)
    {
        BattleSelectWeaponMenu.Clear();
        List <WeaponItem> weaponItems = chLogic.Info.Items.GetAllWeapons();

        foreach (var v in weaponItems)
        {
            var weaponAction = new IActionMenu.UIActionButtonInfo(v.GetName(), () => BattleAction_SelectWeapon(v));
            BattleSelectWeaponMenu.AddAction(weaponAction);
        }
    }
Exemplo n.º 5
0
    /// <summary>
    /// 检查是否拥有位置事件
    /// </summary>
    /// <param name="chLogic"></param>
    /// <param name="info"></param>
    /// <returns></returns>
    public bool GetBattleAction_Location(CharacterLogic chLogic, ref IActionMenu.UIActionButtonInfo info)
    {
        var locationEvent = chapterManager.Event.EventInfo.GetLocationEvent(chLogic.GetTileCoord(), chLogic.GetID());

        if (locationEvent == null)
        {
            Debug.Log("没有Location事件");
            return(false);
        }
        Debug.Log("找到相匹配的Location Event" + locationEvent);

        EnumActionType actionType = EnumActionType.OpenTreasureBox;

        if (locationEvent.Caption == EventInfoCollection.EnumLocationEventCaption.占领)
        {
            actionType = EnumActionType.All;
        }
        if (locationEvent.Caption == EventInfoCollection.EnumLocationEventCaption.访问)
        {
            actionType = EnumActionType.Visit;
        }

        info.name   = locationEvent.GetButtonText();
        info.action = () =>
        {
            gameMode.BeforePlaySequence();
            HideBattlaActionMenu(false);
            if (locationEvent.Sequence != null)
            {
                locationEvent.Execute(chapterManager.Event.EventInfo, () =>
                {
                    gameMode.AfterPlaySequence();
                    if (locationEvent.Caption != EventInfoCollection.EnumLocationEventCaption.占领)//如果是占领,则不再弹出选项菜单了
                    {
                        ShowBattleActionMenu(ActionMenuState, chLogic);
                    }
                });
            }

            chLogic.ConsumeActionPoint(actionType);

            if (locationEvent.Caption == EventInfoCollection.EnumLocationEventCaption.占领)
            {
                //gameMode.ChapterManager.CheckWin_Seize();
            }
            if (locationEvent.Caption == EventInfoCollection.EnumLocationEventCaption.开门)
            {
                //gameMode.GridTileManager.OpenDoor(new Vector2Int(0, 0));
            }
        };
        info.enable = chLogic.IsActionEnable(actionType);
        return(true);
    }
Exemplo n.º 6
0
    public void CheckWaitAction(CharacterLogic chLogic)
    {
        var end = new IActionMenu.UIActionButtonInfo("待机", BattleAction_End, chLogic.IsActionEnable(EnumActionType.Wait));

        BattleActionMenu.AddAction(end);
    }
Exemplo n.º 7
0
    public void CheckAttackAction(CharacterLogic chLogic)
    {
        var attack = new IActionMenu.UIActionButtonInfo("攻击", BattleAction_Attack, chLogic.IsActionEnable(EnumActionType.Attack));

        BattleActionMenu.AddAction(attack);
    }
Exemplo n.º 8
0
    public void CheckMoveAction(CharacterLogic chLogic)
    {
        var move = new IActionMenu.UIActionButtonInfo("移动", BattleAction_Move, chLogic.IsActionEnable(EnumActionType.Move));

        BattleActionMenu.AddAction(move);
    }