コード例 #1
0
        public override void BackState(UIStateMsg msg, params object[] paras)
        {
            if (History.Count > 0)
            {
                var t = History.Pop();
                BattleData.Instance.Agent.SelectCards.Clear();
                BattleData.Instance.Agent.SelectPlayers.Clear();
                if (t == typeof(StateIdle))
                {
                    //一般是多次行动时的取消
                    Current.Process(msg, paras);
                    BattleData.Instance.Agent.SelectSkill = null;
                    BattleData.Instance.Agent.SelectArgs.Clear();
                    MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer);

                    MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard);

                    MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill);
                }
                else
                {
                    ChangeState(t, false, msg, paras);
                }
            }
        }
コード例 #2
0
        public void OnEventTrigger(MessageType eventType, params object[] parameters)
        {
            switch (eventType)
            {
            case MessageType.TURNBEGIN:
                turnBegin = parameters[0] as network.TurnBegin;
                break;

            case MessageType.GAMEINFO:
                gameInfo = parameters[0] as network.GameInfo;
                break;

            case MessageType.COMMANDREQUEST:
                cmdReq = parameters[0] as network.CommandRequest;
                break;

            case MessageType.ERROR:
                var error = parameters[0] as network.Error;
                if (error.id == 30)
                {
                    //离开房间
                    var idx = PlayerInfos.FindIndex(u =>
                    {
                        return(u != null && u.id == error.dst_id);
                    });
                    if (!DisConnectedPlayer.Contains((uint)error.dst_id))
                    {
                        DisConnectedPlayer.Add((uint)error.dst_id);
                        MessageSystem <MessageType> .Notify(MessageType.PlayerLeave, error.dst_id, idx);
                    }
                }
                break;
            }
        }
コード例 #3
0
        public void RemoveAllSelectPlayer()
        {
            SelectPlayers.Clear();
            MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer);

            FSM.HandleMessage(UIStateMsg.ClickPlayer);
        }
コード例 #4
0
        public void ChangeSelectSkill(uint?skillID)
        {
            SelectSkill = skillID;
            MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill);

            FSM.HandleMessage(UIStateMsg.ClickSkill);
        }
コード例 #5
0
        public override void Process(UIStateMsg msg, params object[] paras)
        {
            switch (msg)
            {
            case UIStateMsg.ClickSkill:
                if (BattleData.Instance.Agent.SelectSkill == null)
                {
                    //取消技能
                    stateMachine.BackState(msg, paras);
                    BattleData.Instance.Agent.SelectCards.Clear();
                    BattleData.Instance.Agent.SelectPlayers.Clear();
                    BattleData.Instance.Agent.SelectArgs.Clear();
                    MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer);

                    MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard);

                    MessageSystem <MessageType> .Notify(MessageType.CloseNewArgsUI);
                }
                else
                {
                    //点了别的技能
                    stateMachine.ChangeState <StateSkill>(msg, false, BattleData.Instance.Agent.SelectSkill, paras);
                }
                break;

            case UIStateMsg.ClickCard:
            case UIStateMsg.ClickPlayer:
            case UIStateMsg.ClickArgs:
                base.Process(msg, paras);
                break;
            }
        }
コード例 #6
0
        public void AddSelectArgs(List <uint> args)
        {
            SelectArgs.Clear();
            SelectArgs.AddRange(args);
            MessageSystem <MessageType> .Notify(MessageType.AgentSelectArgs);

            FSM.HandleMessage(UIStateMsg.ClickArgs);
        }
コード例 #7
0
ファイル: WindowsBase.cs プロジェクト: jianm1996/AGrailClient
        public virtual void Awake()
        {
            MessageSystem <MessageType> .Notify(MessageType.OnUICreate, this);

            CanvasGroup        = GetComponent <CanvasGroup>();
            Canvas             = GetComponent <Canvas>();
            Canvas.renderMode  = RenderMode.ScreenSpaceCamera;
            Canvas.worldCamera = Camera.main;
        }
コード例 #8
0
ファイル: PlayerAgent.cs プロジェクト: jianm1996/AGrailClient
        public void RemoveSelectPlayer(uint playerID)
        {
            if (SelectPlayers.Contains(playerID))
            {
                SelectPlayers.Remove(playerID);
            }
            MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer);

            FSM.HandleMessage(UIStateMsg.ClickPlayer);
        }
コード例 #9
0
ファイル: PlayerAgent.cs プロジェクト: jianm1996/AGrailClient
        public void RemoveSelectCard(uint cardID)
        {
            if (SelectCards.Contains(cardID))
            {
                SelectCards.Remove(cardID);
            }
            MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard);

            FSM.HandleMessage(UIStateMsg.ClickCard);
        }
コード例 #10
0
        private void onUIStateChange()
        {
            if (!BattleData.Instance.IsStarted)
            {
                return;
            }
            //UI状态变化,确认哪些能够选择
            foreach (var v in cardUIs)
            {
                if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, v.Card, isShowCovered))
                {
                    v.IsEnable = true;
                }
                else
                {
                    v.IsEnable = false;
                }
            }
            foreach (var v in skillUIs)
            {
                if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, v.Skill))
                {
                    v.IsEnable = true;
                }
                else
                {
                    v.IsEnable = false;
                }
            }
            for (int i = 0; i < players.Count; i++)
            {
                if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, BattleData.Instance.GetPlayerInfo((uint)BattleData.Instance.PlayerIdxOrder[i])))
                {
                    players[i].IsEnable = true;
                }
                else
                {
                    players[i].IsEnable = false;
                }
            }
            btnOK.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.CheckOK(BattleData.Instance.Agent.FSM.Current.StateNumber,
                                                                                    BattleData.Instance.Agent.SelectCards, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectSkill));
            btnCancel.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.CheckCancel(BattleData.Instance.Agent.FSM.Current.StateNumber,
                                                                                            BattleData.Instance.Agent.SelectCards, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectSkill));
            btnResign.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.CheckResign(BattleData.Instance.Agent.FSM.Current.StateNumber));
            btnSpecial.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.CheckBuy(BattleData.Instance.Agent.FSM.Current.StateNumber) ||
                                            BattleData.Instance.Agent.PlayerRole.CheckExtract(BattleData.Instance.Agent.FSM.Current.StateNumber) ||
                                            BattleData.Instance.Agent.PlayerRole.CheckSynthetize(BattleData.Instance.Agent.FSM.Current.StateNumber));
            btnCovered.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.HasCoverd);
            MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer);

            MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard);

            MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill);
        }
コード例 #11
0
ファイル: MoJian.cs プロジェクト: jianm1996/AGrailClient
        public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras)
        {
            switch (state)
            {
            case 902:
            case 906:
                OKAction = () =>
                {
                    if (state == 901)
                    {
                        additionalState = 901;
                    }
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>()
                    {
                        1
                    });
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                CancelAction = () =>
                {
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>()
                    {
                        0
                    });
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint,
                                                                      string.Format("是否发动{0}", Skills[state].SkillName));

                return;

            case 905:
                OKAction = () =>
                {
                    sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                CancelAction = () =>
                {
                    BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init);
                };
                return;
            }
            base.UIStateChange(state, msg, paras);
            if (additionalState == 901)
            {
                //这代码真傻...应该做成list的
                //但懒得改了
                var t1 = OKAction;
                var t2 = ResignAction;
                OKAction     = () => { t1(); additionalState = 0; };
                ResignAction = () => { t2(); additionalState = 0; };
            }
        }
コード例 #12
0
ファイル: Lobby.cs プロジェクト: Rangocold/AGrailClient
        public void OnEventTrigger(MessageType eventType, params object[] parameters)
        {
            switch (eventType)
            {
            case MessageType.ROOMLISTRESPONSE:
                var roomListProto = parameters[0] as network.RoomListResponse;
                RoomInfo = roomListProto.rooms.OrderBy(t => t.playing).ThenBy(t => t.room_id).ToList();
                MessageSystem <MessageType> .Notify(MessageType.RoomList);

                break;
            }
        }
コード例 #13
0
ファイル: MoJian.cs プロジェクト: Rangocold/AGrailClient
        public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras)
        {
            switch (state)
            {
            case 902:
            case 906:
                OKAction = () =>
                {
                    if (state == 901)
                    {
                        additionalState = 901;
                    }
                    if (state == 902)
                    {
                        IsStart = true;
                    }
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>()
                    {
                        1
                    });
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                CancelAction = () =>
                {
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>()
                    {
                        0
                    });
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state));

                return;

            case 905:
                if (BattleData.Instance.Agent.SelectPlayers.Count == 1 && BattleData.Instance.Agent.SelectCards.Count == 2)
                {
                    sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                    return;
                }
                ;
                CancelAction = () =>
                {
                    BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init);
                };
                MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state));

                return;
            }
            base.UIStateChange(state, msg, paras);
        }
コード例 #14
0
        public override void Awake()
        {
            MessageSystem <MessageType> .Regist(MessageType.RoomIDChange, this);

            MessageSystem <MessageType> .Regist(MessageType.ChatChange, this);

            MessageSystem <MessageType> .Regist(MessageType.ChooseRole, this);

            MessageSystem <MessageType> .Regist(MessageType.PlayerLeave, this);

            MessageSystem <MessageType> .Regist(MessageType.PlayerIsReady, this);

            MessageSystem <MessageType> .Regist(MessageType.PlayerNickName, this);

            MessageSystem <MessageType> .Regist(MessageType.PlayerTeamChange, this);

            MessageSystem <MessageType> .Regist(MessageType.LEADERREQUEST, this);

            MessageSystem <MessageType> .Regist(MessageType.GameStart, this);

            MessageSystem <MessageType> .Regist(MessageType.ERROR, this);

            foreach (var v in players)
            {
                v.Reset();
            }
            roomTitle.text = string.Format("{0} {1}", Lobby.Instance.SelectRoom.room_id, Lobby.Instance.SelectRoom.room_name);
            if (Lobby.Instance.SelectRoom.max_player == 4)
            {
                GameObject.Destroy(players[5].gameObject);
                GameObject.Destroy(players[4].gameObject);
                players.RemoveRange(4, 2);
            }
            for (int i = 0; i < BattleData.Instance.PlayerInfos.Count; i++)
            {
                MessageSystem <MessageType> .Notify(MessageType.PlayerIsReady, i, BattleData.Instance.PlayerInfos[i].ready);

                MessageSystem <MessageType> .Notify(MessageType.PlayerNickName, i, BattleData.Instance.PlayerInfos[i].nickname);

                MessageSystem <MessageType> .Notify(MessageType.PlayerTeamChange, i, BattleData.Instance.PlayerInfos[i].team);
            }

            root.localPosition = new Vector3(1280, 0, 0);
            root.DOLocalMoveX(0, 1).OnComplete(() => { btnExit.interactable = true; });

            btnChooseRedTeam.onClick.AddListener(delegate { chooseTeam(Team.Red); });
            btnChooseBlueTeam.onClick.AddListener(delegate { chooseTeam(Team.Blue); });
            btnChooseRandomTeam.onClick.AddListener(delegate { chooseTeam(Team.Other); });
            btnBecomeLeader.onClick.AddListener(delegate { chooseLeader(true); });
            btnNotLeader.onClick.AddListener(delegate { chooseLeader(false); });
            base.Awake();
        }
コード例 #15
0
        public override void Enter(UIStateMsg msg, params object[] paras)
        {
            BattleData.Instance.Agent.SelectCards.Clear();
            BattleData.Instance.Agent.SelectPlayers.Clear();
            BattleData.Instance.Agent.SelectSkill = null;
            MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer);

            MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard);

            MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill);

            base.Enter(msg, paras);
        }
コード例 #16
0
        private void onUIStateChange()
        {
            //UI状态变化,确认哪些能够选择
            foreach (var v in cardUIs)
            {
                if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, v.Card, isShowCovered))
                {
                    v.IsEnable = true;
                }
                else
                {
                    v.IsEnable = false;
                }
            }
            foreach (var v in skillUIs)
            {
                if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, v.Skill))
                {
                    v.IsEnable = true;
                }
                else
                {
                    v.IsEnable = false;
                }
            }
            foreach (var v in players.Keys)
            {
                if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, BattleData.Instance.PlayerInfos[v]))
                {
                    players[v].IsEnable = true;
                }
                else
                {
                    players[v].IsEnable = false;
                }
            }
            btnOK.interactable = BattleData.Instance.Agent.PlayerRole.CheckOK(BattleData.Instance.Agent.FSM.Current.StateNumber,
                                                                              BattleData.Instance.Agent.SelectCards, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectSkill);
            btnCancel.interactable = BattleData.Instance.Agent.PlayerRole.CheckCancel(BattleData.Instance.Agent.FSM.Current.StateNumber,
                                                                                      BattleData.Instance.Agent.SelectCards, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectSkill);
            BtnResign.interactable     = BattleData.Instance.Agent.PlayerRole.CheckResign(BattleData.Instance.Agent.FSM.Current.StateNumber);
            btnBuy.interactable        = BattleData.Instance.Agent.PlayerRole.CheckBuy(BattleData.Instance.Agent.FSM.Current.StateNumber);
            btnExtract.interactable    = BattleData.Instance.Agent.PlayerRole.CheckExtract(BattleData.Instance.Agent.FSM.Current.StateNumber);
            btnSynthetize.interactable = BattleData.Instance.Agent.PlayerRole.CheckSynthetize(BattleData.Instance.Agent.FSM.Current.StateNumber);
            btnCovered.interactable    = BattleData.Instance.Agent.PlayerRole.HasCoverd;
            MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer);

            MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard);

            MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill);
        }
コード例 #17
0
ファイル: PlayerAgent.cs プロジェクト: jianm1996/AGrailClient
        public void AddSelectCard(uint cardID)
        {
            if (!SelectCards.Contains(cardID))
            {
                SelectCards.Add(cardID);
                while (SelectCards.Count > PlayerRole.MaxSelectCard(FSM.Current.StateNumber))
                {
                    SelectCards.RemoveAt(0);
                }
            }
            MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard);

            FSM.HandleMessage(UIStateMsg.ClickCard);
        }
コード例 #18
0
ファイル: MoDao.cs プロジェクト: Rangocold/AGrailClient
        public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras)
        {
            switch (state)
            {
            case 801:
                if (BattleData.Instance.Agent.SelectPlayers.Count == 2 && BattleData.Instance.Agent.SelectCards.Count == 1)
                {
                    sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id,
                                  BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state,
                                  BattleData.Instance.Agent.SelectArgs);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                    return;
                }
                ;
                CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); };
                MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state));

                return;

            case 804:
                if (BattleData.Instance.Agent.SelectPlayers.Count == 2)
                {
                    sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id,
                                  BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state,
                                  BattleData.Instance.Agent.SelectArgs);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                    return;
                }
                ;
                MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state));

                CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); };
                return;

            case 803:
                if (BattleData.Instance.Agent.SelectPlayers.Count == 1 && BattleData.Instance.Agent.SelectCards.Count == 1)
                {
                    sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id,
                                  BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state,
                                  BattleData.Instance.Agent.SelectArgs);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                }
                ;
                CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); };
                MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state));

                return;
            }
            base.UIStateChange(state, msg, paras);
        }
コード例 #19
0
ファイル: Lobby.cs プロジェクト: Rangocold/AGrailClient
        public void GetRoomList()
        {
            var proto = new network.RoomListRequest()
            {
                role_strategy = network.ROLE_STRATEGY.ROLE_STRATEGY_ALL
            };

            GameManager.TCPInstance.Send(new Protobuf()
            {
                Proto = proto, ProtoID = ProtoNameIds.ROOMLISTREQUEST
            });
            RoomInfo = null;
            MessageSystem <MessageType> .Notify(MessageType.RoomList);
        }
コード例 #20
0
        public void OnEventTrigger(MessageType eventType, params object[] parameters)
        {
            switch (eventType)
            {
            case MessageType.ROLEREQUEST:
                var proto = parameters[0] as network.RoleRequest;
                RoleStrategy = proto.strategy;
                CanIChoose   = proto.id == BattleData.Instance.PlayerID;
                RoleIDs      = proto.role_ids;
                MessageSystem <MessageType> .Notify(MessageType.ChooseRole, RoleStrategy);

                break;
            }
        }
コード例 #21
0
        private void onBtnGiveUpClick()
        {
            PollingResponse proto = new PollingResponse()
            {
                option = 1
            };

            GameManager.TCPInstance.Send(new Protobuf()
            {
                Proto = proto, ProtoID = ProtoNameIds.POLLINGRESPONSE
            });
            MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, "已投票,请稍等");

            GameManager.UIInstance.PopWindow(Framework.UI.WinMsg.None);
        }
コード例 #22
0
        public override void Awake()
        {
            MessageSystem <MessageType> .Regist(MessageType.RoomList, this);

            MessageSystem <MessageType> .Regist(MessageType.EnterRoom, this);

            MessageSystem <MessageType> .Regist(MessageType.ERROR, this);

            root.localPosition = new Vector3(Screen.width, 0, 0);
            root.DOLocalMoveX(0, 1.0f);
            Lobby.Instance.GetRoomList();

            MessageSystem <MessageType> .Notify(MessageType.PlayBGM);

            base.Awake();
        }
コード例 #23
0
        public override void Enter(UIStateMsg msg, params object[] paras)
        {
            var canUseHealCount = BattleData.Instance.Agent.Cmd.args[3];
            var harmPoint       = BattleData.Instance.Agent.Cmd.args[1];
            var selectList      = new List <List <uint> >();

            //服务器默认玩家有治疗时才会发这个响应
            for (uint i = Math.Min(canUseHealCount, harmPoint); i > 0; i--)
            {
                selectList.Add(new List <uint>()
                {
                    i
                });
            }
            MessageSystem <MessageType> .Notify(MessageType.ShowArgsUI, "Heal", selectList);

            base.Enter(msg, paras);
        }
コード例 #24
0
ファイル: AnSha.cs プロジェクト: Rangocold/AGrailClient
        public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras)
        {
            switch (state)
            {
            case 502:
                OKAction = () =>
                {
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, BattleData.Instance.Agent.SelectCards);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                CancelAction = () =>
                {
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                MessageSystem <MessageType> .Notify(MessageType.SendHint, StateHint.GetHint(state));

                return;

            case 503:
                OKAction = () =>
                {
                    IsStart = true;
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>()
                    {
                        1
                    });
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                CancelAction = () =>
                {
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>()
                    {
                        0
                    });
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                MessageSystem <MessageType> .Notify(MessageType.SendHint, StateHint.GetHint(state));

                return;
            }
            base.UIStateChange(state, msg, paras);
        }
コード例 #25
0
ファイル: Lobby.cs プロジェクト: xdestiny110/AGrailClient
        public void OnEventTrigger(MessageType eventType, params object[] parameters)
        {
            switch (eventType)
            {
            case MessageType.ROOMLISTRESPONSE:
                var roomListProto = parameters[0] as network.RoomListResponse;
                RoomInfo = roomListProto.rooms.OrderBy(t => t.playing).ThenBy(t => t.room_id).ToList();
                if (PlayerPrefs.HasKey("lastGame"))
                {
                    network.RoomListResponse.RoomInfo room = getRoomInfoByID(PlayerPrefs.GetInt("lastGame"));
                    if (room != null)
                    {
                        JoinRoom(room);
                    }
                }
                MessageSystem <MessageType> .Notify(MessageType.RoomList);

                break;
            }
        }
コード例 #26
0
        public override void Process(UIStateMsg msg, params object[] paras)
        {
            switch (msg)
            {
            case UIStateMsg.ClickCard:
            case UIStateMsg.ClickPlayer:
                if (BattleData.Instance.Agent.SelectCards.Count == 1 &&
                    Card.GetCard(BattleData.Instance.Agent.SelectCards[0]).Element == Card.CardElement.light)
                {
                    BattleData.Instance.Agent.SelectPlayers.Clear();
                    MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer);
                }
                base.Process(msg, paras);
                break;

            default:
                base.Process(msg, paras);
                break;
            }
        }
コード例 #27
0
ファイル: Lobby.cs プロジェクト: Rangocold/AGrailClient
        public void JoinRoom(network.RoomListResponse.RoomInfo roomInfo, string password = null)
        {
            var proto = new network.EnterRoomRequest()
            {
                room_id = roomInfo.room_id
            };

            if (!string.IsNullOrEmpty(password))
            {
                proto.password = password;
            }
            GameManager.TCPInstance.Send(new Protobuf()
            {
                Proto = proto, ProtoID = ProtoNameIds.ENTERROOMREQUEST
            });
            BattleData.Instance.Reset();
            //其实这么写不太合适,但后端没有合适的协议
            SelectRoom = roomInfo;
            //防止多次点击
            MessageSystem <MessageType> .Notify(MessageType.EnterRoom);
        }
コード例 #28
0
        public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras)
        {
            switch (state)
            {
            case 1702:
            case 1703:
                OKAction = () =>
                {
                    sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id,
                                  BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state,
                                  BattleData.Instance.Agent.SelectArgs);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); };
                MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint,
                                                                      string.Format("{0}: 请选择目标玩家以及异系卡牌", Skills[state].SkillName));

                return;

            case 1704:
                OKAction = () =>
                {
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id,
                                   BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                CancelAction = () =>
                {
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id);
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint,
                                                                      string.Format("{0}: 请选择目标玩家以及同系卡牌", Skills[state].SkillName));

                return;
            }
            base.UIStateChange(state, msg, paras);
        }
コード例 #29
0
ファイル: JianSheng.cs プロジェクト: jianm1996/AGrailClient
        public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras)
        {
            switch (state)
            {
            case 102:
                OKAction = () =>
                {
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>()
                    {
                        1
                    });
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                CancelAction = () =>
                {
                    sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>()
                    {
                        0
                    });
                    BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true);
                };
                MessageSystem <MessageType> .Notify(MessageType.SendHint, string.Format("是否发动{0}", Skills[state].SkillName));

                return;
            }
            base.UIStateChange(state, msg, paras);
            if (additionalState == 103)
            {
                //这代码真傻...应该做成list的
                //但懒得改了
                var t1 = OKAction;
                var t2 = ResignAction;
                OKAction     = () => { t1(); additionalState = 0; };
                ResignAction = () => { t2(); additionalState = 0; };
            }
        }
コード例 #30
0
        void Awake()
        {
            players = GetComponent <BattleUIMobile>().PlayerStatus;
            btnSetting.onClick.AddListener(onBtnSettingClick);
            btnSpecial.onClick.AddListener(onBtnSpecialClick);
            btnOK.onClick.AddListener(onBtnOKClick);
            btnCancel.onClick.AddListener(onBtnCancelClick);
            btnResign.onClick.AddListener(onBtnResignClick);
            btnCovered.onClick.AddListener(OnCoveredClick);

            MessageSystem <MessageType> .Regist(MessageType.AgentUpdate, this);

            MessageSystem <MessageType> .Regist(MessageType.AgentHandChange, this);

            MessageSystem <MessageType> .Regist(MessageType.AgentStateChange, this);

            MessageSystem <MessageType> .Regist(MessageType.AgentSelectSkill, this);

            MessageSystem <MessageType> .Regist(MessageType.AgentUIStateChange, this);

            MessageSystem <MessageType> .Regist(MessageType.ShowNewArgsUI, this);

            MessageSystem <MessageType> .Regist(MessageType.CloseNewArgsUI, this);

            MessageSystem <MessageType> .Regist(MessageType.Lose, this);

            MessageSystem <MessageType> .Regist(MessageType.Win, this);

            MessageSystem <MessageType> .Regist(MessageType.AgentSelectCard, this);

            MessageSystem <MessageType> .Notify(MessageType.AgentUpdate);

            MessageSystem <MessageType> .Notify(MessageType.AgentHandChange);

            MessageSystem <MessageType> .Notify(MessageType.AgentUIStateChange);
        }