示例#1
0
        void Awake()
        {
            btn.onClick.AddListener(onBtnClick);

            MessageSystem<MessageType>.Regist(MessageType.AgentSelectSkill, this);
        }
示例#2
0
 public Lobby() : base()
 {
     MessageSystem <MessageType> .Regist(MessageType.ROOMLISTRESPONSE, this);
 }
        public override void Awake()
        {
            if (Lobby.Instance.SelectRoom.max_player != 6)
            {
                Destroy(players[0].gameObject);
                players.RemoveAt(0);
                Destroy(players[3].gameObject);
                players.RemoveAt(3);
                Destroy(nicknames[0].gameObject);
                nicknames.RemoveAt(0);
                Destroy(nicknames[3].gameObject);
                nicknames.RemoveAt(3);

                Destroy(pools[0].gameObject);
                pools.RemoveAt(0);
                Destroy(pools[0].gameObject);
                pools.RemoveAt(0);
                Destroy(pools[0].gameObject);
                pools.RemoveAt(0);
                Destroy(pools[0].gameObject);
                pools.RemoveAt(0);
                Destroy(seats[5].gameObject);
                Destroy(seats[4].gameObject);
                seats.RemoveAt(5);
                seats.RemoveAt(4);
            }
            if (BattleData.Instance.MainPlayer.team == 0)
            {
                RedGroup.localPosition           = new Vector3(450, 300, 0);
                BlueGroup.localPosition          = new Vector3(-450, 300, 0);
                redHero.transform.localPosition  = new Vector3(370, -100, 0);
                blueHero.transform.localPosition = new Vector3(-370, -100, 0);
                FlagGroup.localScale             = new Vector3(-1, 1, 0);
            }
            var idx = BattleData.Instance.PlayerIdxOrder.IndexOf((int)BattleData.Instance.StartPlayerID);
            int a = 0, b = players.Count / 2;

            for (int i = 0; i < players.Count; i++)
            {
                var player = BattleData.Instance.GetPlayerInfo((uint)BattleData.Instance.PlayerIdxOrder[(i + idx) % players.Count]);
                seats[i].sprite = (player.team == (uint)Team.Blue) ?
                                  AssetBundleManager.Instance.LoadAsset <Sprite>("lobby_texture", "seatBlueSquare") :
                                  AssetBundleManager.Instance.LoadAsset <Sprite>("lobby_texture", "seatRedSquare");
                if (player.team == (uint)Team.Blue)
                {
                    players[a].ID   = player.id;
                    players[a].Seat = i;
                    if (player.leader == 1)
                    {
                        BlueLeader.transform.SetParent(players[a].transform);
                        BlueLeader.transform.localPosition = new Vector3(0, 35, 0);
                        BlueLeader.gameObject.SetActive(true);
                    }
                    nicknames[a++].text = player.nickname;
                }
                else
                {
                    players[b].ID   = player.id;
                    players[b].Seat = i;
                    if (player.leader == 1)
                    {
                        RedLeader.transform.SetParent(players[b].transform);
                        RedLeader.transform.localPosition = new Vector3(0, 0, 0);
                        RedLeader.gameObject.SetActive(true);
                    }
                    nicknames[b++].text = player.nickname;
                }
            }
            for (int i = 0; i < RoleChoose.Instance.RoleIDs.Count; i++)
            {
                pools[i].HeroID    = RoleChoose.Instance.RoleIDs[i];
                pools[i].Selected  = (RoleChoose.Instance.options[i] > 0);
                pools[i].canselect = RoleChoose.Instance.oprater == BattleData.Instance.PlayerID;
                uint id = RoleChoose.Instance.RoleIDs[i];
                pools[i].MVP.onClick.AddListener(delegate { onHeroClick(id); });
            }
            choosing   = 0;
            lastChosen = 0;
            BPBtn.onClick.AddListener(onSureClick);
            CancelBtn.onClick.AddListener(cancelIB);
            btnLogExpand.onClick.AddListener(delegate { onBtnLogExpandClick(true); });
            btnChatExpand.onClick.AddListener(delegate { onBtnChatExpandClick(true); });
            btnSubmit.onClick.AddListener(delegate { onBtnSubmitClick(null); });
            inptChat.onEndEdit.AddListener(onBtnSubmitClick);

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

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

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

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

            base.Awake();
        }
 void Awake()
 {
     MessageSystem <MessageType> .Regist(MessageType.AgentSelectPlayer, this);
 }
示例#5
0
 public RoleChoose() : base()
 {
     MessageSystem <MessageType> .Regist(MessageType.ROLEREQUEST, this);
 }
示例#6
0
        public override void Awake()
        {
            if (Lobby.Instance.SelectRoom.max_player != 6)
            {
                GameObject.Destroy(playerStatus[2].gameObject);
                playerStatus.RemoveAt(2);
                GameObject.Destroy(playerStatus[3].gameObject);
                playerStatus.RemoveAt(3);
                GameObject.Destroy(MVPS[0].gameObject);
                MVPS.RemoveAt(0);
                GameObject.Destroy(MVPS[1].gameObject);
                MVPS.RemoveAt(1);
            }
            Dialog.Instance.Reset();

            btnLogExpand.onClick.AddListener(delegate { onBtnLogExpandClick(true); });
            btnChatExpand.onClick.AddListener(delegate { onBtnChatExpandClick(true); });
            btnSubmit.onClick.AddListener(delegate { onBtnSubmitClick(null); });
            inptChat.onEndEdit.AddListener(onBtnSubmitClick);
            MessageSystem <MessageType> .Regist(MessageType.RoomIDChange, this);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            //依据数据初始化界面
            MessageSystem <MessageType> .Notify(MessageType.PlayBGM);

            MessageSystem <MessageType> .Notify(MessageType.MoraleChange, Team.Red, BattleData.Instance.Morale[(int)Team.Red]);

            MessageSystem <MessageType> .Notify(MessageType.MoraleChange, Team.Blue, BattleData.Instance.Morale[(int)Team.Blue]);

            MessageSystem <MessageType> .Notify(MessageType.GemChange, Team.Red, (int)BattleData.Instance.Gem[(int)Team.Red]);

            MessageSystem <MessageType> .Notify(MessageType.GemChange, Team.Blue, (int)BattleData.Instance.Gem[(int)Team.Blue]);

            MessageSystem <MessageType> .Notify(MessageType.CrystalChange, Team.Red, (int)BattleData.Instance.Crystal[(int)Team.Red]);

            MessageSystem <MessageType> .Notify(MessageType.CrystalChange, Team.Blue, (int)BattleData.Instance.Crystal[(int)Team.Blue]);

            MessageSystem <MessageType> .Notify(MessageType.GrailChange, Team.Red, BattleData.Instance.Grail[(int)Team.Red]);

            MessageSystem <MessageType> .Notify(MessageType.GrailChange, Team.Blue, BattleData.Instance.Grail[(int)Team.Blue]);

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

            var playerIdxOrder = BattleData.Instance.PlayerIdxOrder;

            if (playerIdxOrder.Count == BattleData.Instance.PlayerInfos.Count && playerIdxOrder.Count > 0)
            {
                for (int i = 0; i < playerStatus.Count; i++)
                {
                    var playerInfo = BattleData.Instance.GetPlayerInfo((uint)playerIdxOrder[i]);
                    playerStatus[i].ID = playerInfo.id;
                    MessageSystem <MessageType> .Notify(MessageType.PlayerNickName, i, playerInfo.nickname);

                    MessageSystem <MessageType> .Notify(MessageType.PlayerTeamChange, i, playerInfo.team);

                    MessageSystem <MessageType> .Notify(MessageType.PlayerRoleChange, i, playerInfo.role_id);

                    MessageSystem <MessageType> .Notify(MessageType.PlayerHandChange, i, playerInfo.hand_count, playerInfo.max_hand);

                    MessageSystem <MessageType> .Notify(MessageType.PlayerHealChange, i, playerInfo.heal_count);

                    MessageSystem <MessageType> .Notify(MessageType.PlayerTokenChange, i,
                                                        playerInfo.yellow_token, playerInfo.blue_token, playerInfo.covered_count);

                    MessageSystem <MessageType> .Notify(MessageType.PlayerEnergeChange, i, playerInfo.gem, playerInfo.crystal);

                    MessageSystem <MessageType> .Notify(MessageType.PlayerKneltChange, i, playerInfo.is_knelt);

                    MessageSystem <MessageType> .Notify(MessageType.PlayerBasicAndExCardChange, i, playerInfo.basic_cards, playerInfo.ex_cards);
                }
                MessageSystem <MessageType> .Notify(MessageType.AgentHandChange);
            }

            base.Awake();
        }
示例#7
0
 void Awake()
 {
     MessageSystem <MessageType> .Regist(MessageType.AgentSelectSkill, this);
 }
示例#8
0
        public override void Awake()
        {
            //依据房间人数先去掉不存在anchor
            if (Lobby.Instance.SelectRoom.max_player != 6)
            {
                playerAnchor.RemoveAt(2);
                playerAnchor.RemoveAt(3);
            }
            //测试基本上都是先生成UI才会收到GameInfo事件
            //但不确定是否有可能反过来
            //最好是能够在Awake中先依据BattleData的数据初始化一遍
            Dialog.Instance.Reset();
            PlayersStatus.Clear();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            root.localPosition = new Vector3(Screen.width, 0, 0);
            root.DOLocalMoveX(0, 1.0f).OnComplete(() => { GameManager.AddUpdateAction(onESCClick); });
            base.Awake();
        }