コード例 #1
0
 public void Popup(PlayerAction action, GameObject boardCardFrame, PCBoardBehavior boardBehavior)
 {
     gameObject.SetActive(true);
     this.transform.position = new Vector3(boardCardFrame.transform.position.x, boardCardFrame.transform.position.y, -5f);
     Action = action;
     trigger.BoardBehavior = boardBehavior;
 }
コード例 #2
0
        public void BindAction(List <PlayerAction> actions, PCBoardBehavior boardBehavior)
        {
            if (boardBehavior == null)
            {
                return;
            }

            var cells = DisplayBehavior.Cells;

            if (cells == null)
            {
                return;
            }

            Age[] ages = { Age.A, Age.I, Age.II, Age.III };

            for (int i = 0; i < 4; i++)
            {
                if (!cells.ContainsKey(ages[i]))
                {
                    continue;
                }

                //显示图片
                var cellInfo = cells[ages[i]];

                BindCell(actions, boardBehavior, DisplayBehavior.Frames[i].FindObject("CardDisplay").GetComponent <SpecificCodeActionTrigger>(), i, cellInfo);
            }
        }
コード例 #3
0
        public void BindAction(List <PlayerAction> actions, PCBoardBehavior boardBehavior)
        {
            Actions          = actions;
            Behavior         = boardBehavior;
            _refreshRequired = true;

            //Buttons
            PassPoliticalPhaseButton.Bind(
                Actions.FirstOrDefault(a => a.ActionType == PlayerActionType.PassPoliticalPhase), Behavior);
        }
コード例 #4
0
        private void BindCell(List <PlayerAction> actions, PCBoardBehavior BoardBehavior, SpecificCodeActionTrigger trigger, int index, BuildingCell cell)
        {
            trigger.BoardBehavior = null;

            if (BoardBehavior.InterAction == null)
            {
                //将点击建筑物面板作为主操作的,只有两个可能
                //1、升级建筑物
                //2、建造新的建筑物
                //3、拆除和摧毁
                if (BoardBehavior.CurrentPlayerBoardIndex != SceneTransporter.CurrentGame.MyPlayerIndex)
                {
                    //不是自己的面板不显示操作菜单
                    return;
                }

                //因此按下的时候应该触发轮盘按钮
                //
                trigger.ActionOnMouseClick = () =>
                {
                    //匿名方法参数传递
                    int localIndex   = index;
                    var localActions = actions;

                    List <PlayerAction> acceptedActions = new List <PlayerAction>();

                    foreach (var action in localActions)
                    {
                        if (action.ActionType == PlayerActionType.BuildBuilding &&
                            ((CardInfo)action.Data[0]).InternalId == cell.Card.InternalId)
                        {
                            acceptedActions.Add(action);
                        }

                        if (action.ActionType == PlayerActionType.UpgradeBuilding)
                        {
                            if (((CardInfo)action.Data[0]).InternalId == cell.Card.InternalId ||
                                ((CardInfo)action.Data[1]).InternalId == cell.Card.InternalId)
                            {
                                acceptedActions.Add(action);
                            }
                        }
                        if (action.ActionType == PlayerActionType.Disband ||
                            action.ActionType == PlayerActionType.Destory)
                        {
                            if (((CardInfo)action.Data[0]).InternalId == cell.Card.InternalId)
                            {
                                acceptedActions.Add(action);
                            }
                        }
                    }
                    MenuFrame.Collapse();
                    MenuFrame.Popup(acceptedActions, null);
                };

                trigger.ActionOnMouseClickOutside = () =>
                {
                    MenuFrame.Collapse();
                };
                trigger.BoardBehavior = BoardBehavior;
            }
            else
            {
                //次要操作分门别类列在这里
            }
        }
コード例 #5
0
 public void Bind(PlayerAction action, PCBoardBehavior boardBehavior)
 {
     this._boardBehavior = boardBehavior;
     this._action        = action;
 }