예제 #1
0
        private void OnSceneActived(object sender, object data)
        {
            _DTO_enter_battle dto = (( _PACKET_BATTLE_ACMD_ENTER_BATTLE )data).dto;

            this._loader = null;


            BattleParams param;

            param.frameRate         = dto.frameRate;
            param.framesPerKeyFrame = dto.framesPerKeyFrame;
            param.uid     = dto.uid;
            param.id      = dto.mapId;
            param.rndSeed = dto.rndSeed;
            int count = dto.players.Length;

            param.players = new BattleParams.Player[count];
            for (int i = 0; i < count; i++)
            {
                _DTO_player_info    playerInfoDTO = dto.players[i];
                BattleParams.Player p;
                p.id             = playerInfoDTO.uid;
                p.cid            = playerInfoDTO.cid;
                p.name           = playerInfoDTO.name;
                p.skin           = playerInfoDTO.skin;
                p.team           = playerInfoDTO.team;
                param.players[i] = p;
            }

            UIManager.EnterBattle(param);
        }
예제 #2
0
        private void OnEnterBattle(Packet packet)
        {
            _DTO_enter_battle dto = (( _PACKET_BATTLE_ACMD_ENTER_BATTLE )packet).dto;
            BattleParams      param;

            param.frameRate         = dto.frameRate;
            param.framesPerKeyFrame = dto.framesPerKeyFrame;
            param.uid     = dto.uid;
            param.id      = dto.mapId;
            param.rndSeed = dto.rndSeed;
            int count = dto.players.Length;

            param.players = new BattleParams.Player[count];
            for (int i = 0; i < count; i++)
            {
                _DTO_player_info    playerInfoDTO = dto.players[i];
                BattleParams.Player p;
                p.id             = playerInfoDTO.uid;
                p.cid            = playerInfoDTO.cid;
                p.name           = playerInfoDTO.name;
                p.skin           = playerInfoDTO.skin;
                p.team           = playerInfoDTO.team;
                param.players[i] = p;
            }

            UIManager.EnterBattle(param);
        }
예제 #3
0
        private void OnRoomInfo(Packet packet)
        {
            this._root.CloseModalWait();

            _DTO_room_info_detail dto = (( _PACKET_ROOM_ACMD_ROOM_INFO )packet).dto;

            GComboBox maps = this._root["map"].asComboBox;

            maps.value = dto.map;

            GComboBox heros = this._root["hero"].asComboBox;

            _DTO_player_info[] players = dto.players;
            GList t1 = this._root["t1"].asCom["list"].asList;
            GList t2 = this._root["t2"].asCom["list"].asList;

            t1.RemoveChildrenToPool();
            t2.RemoveChildrenToPool();
            for (int i = 0; i < players.Length; i++)
            {
                _DTO_player_info infoDto = players[i];
                GComponent       item    = infoDto.team == 0 ? t1.AddItemFromPool().asCom : t2.AddItemFromPool().asCom;
                item.GetController("c1").selectedIndex = 0;
                item["name"].asTextField.text          = infoDto.name;
                item.GetController("c1").selectedIndex = infoDto.ready ? 1 : 0;
                if (infoDto.uid == CUser.id)
                {
                    heros.value = infoDto.cid;
                }
            }
            this._root["name"].asTextField.text = dto.name;

            GButton fightBtn = this._root["fightBtn"].asButton;

            if (dto.host == CUser.id)
            {
                this._root.GetController("c1").selectedIndex = 0;
                bool isAllPlayerReady = this.IsAllPlayerReady(dto);
                if (isAllPlayerReady)
                {
                    fightBtn.grayed    = false;
                    fightBtn.touchable = true;
                }
                else
                {
                    fightBtn.grayed    = true;
                    fightBtn.touchable = false;
                }
            }
            else
            {
                this._root.GetController("c1").selectedIndex = 1;
            }
        }
예제 #4
0
        public static _DTO_player_info[] GetPlayerInfoInRoom(Room room)
        {
            int count  = room.teamOne.Count;
            int count2 = room.teamTwo.Count;
            var dtos   = new _DTO_player_info[count + count2];

            for (int i = 0; i < count; i++)
            {
                Room.Player player = room.teamOne[i];
                dtos[i] = ProtocolManager.DTO_player_info(player.hero, player.name, player.ready, ( byte )(player.model << 4 | player.skin), 0, player.id);
            }
            for (int i = 0; i < count2; i++)
            {
                Room.Player player = room.teamTwo[i];
                dtos[count + i] = ProtocolManager.DTO_player_info(player.hero, player.name, player.ready, ( byte )(player.model << 4 | player.skin), 1, player.id);
            }
            return(dtos);
        }
예제 #5
0
        public static _DTO_room_info_detail GetRoomInfoDTO(Room room)
        {
            int count  = room.teamOne.Count;
            int count2 = room.teamTwo.Count;

            _DTO_player_info[] players = new _DTO_player_info[count + count2];
            for (int i = 0; i < count; i++)
            {
                Room.Player player = room.teamOne[i];
                players[i] = ProtocolManager.DTO_player_info(player.hero, player.name, player.ready, ( byte )(player.model << 4 | player.skin), 0, player.id);
            }
            for (int i = 0; i < count2; i++)
            {
                Room.Player player = room.teamTwo[i];
                players[count + i] = ProtocolManager.DTO_player_info(player.hero, player.name, player.ready, ( byte )(player.model << 4 | player.skin), 1, player.id);
            }
            return(ProtocolManager.DTO_room_info_detail(room.hostId, room.map, room.name, players, room.id));
        }