Exemple #1
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);
    }