Ejemplo n.º 1
0
        private void DealSendData_ChangeRoom(byte[] byt)
        {
            //接收房间数据
            int index = 4;

            name = GlobalC.GetSendData_Str(byt, ref index);

            ID        = GlobalC.GetSendData_Int(byt, ref index);
            soutai    = GlobalC.GetSendData_Int(byt, ref index);
            Boss      = GlobalC.GetSendData_Int(byt, ref index);
            mode      = GlobalC.GetSendData_Int(byt, ref index);
            mapTypeID = GlobalC.GetSendData_Int(byt, ref index);
            mapID     = GlobalC.GetSendData_Int(byt, ref index);

            IsGame   = GlobalC.GetSendData_Bool(byt, ref index);
            Islock   = GlobalC.GetSendData_Bool(byt, ref index);
            IsWS     = GlobalC.GetSendData_Bool(byt, ref index);
            modeFree = GlobalC.GetSendData_Bool(byt, ref index);

            for (int i = 0; i < 6; i++)
            {
                players[i].enabled = GlobalC.GetSendData_Bool(byt, ref index);
                players[i].IsReady = GlobalC.GetSendData_Bool(byt, ref index);
                players[i].team    = GlobalC.GetSendData_Int(byt, ref index);
            }
        }
Ejemplo n.º 2
0
        private void DealSendData_ChangeDelay(byte[] byt)
        {
            //改变延迟
            int index = 4;
            int delay = GlobalC.GetSendData_Int(byt, ref index);

            inputManager.delayFps = delay;
        }
Ejemplo n.º 3
0
        private void DealSendData_DelPlayer(byte[] byt)
        {
            //玩家退出
            int index = 4;
            int sit   = GlobalC.GetSendData_Int(byt, ref index);

            players[sit].player = null;
        }
Ejemplo n.º 4
0
        private void DealSendData_ChangePlayer(byte[] byt)
        {
            //接收玩家数据
            int index  = 4;
            int sit    = GlobalC.GetSendData_Int(byt, ref index);
            var player = new PlayerData();

            player.SetSendData_All(byt, ref index);
            players[sit].player = player;
        }
Ejemplo n.º 5
0
        private void DealSendData_TeamChange(byte[] byt, int sit)
        {
            //读取队伍编号
            int index     = 4;
            int TeamIndex = GlobalC.GetSendData_Int(byt, ref index);

            //更新队伍
            SetRoomTeam(sit, TeamIndex);

            //重新发送房间状态
            var dat = GetSendData_All();

            clientS.AddData(dat);
        }
Ejemplo n.º 6
0
        private void DealSendData_Input(byte[] byt)
        {
            //键盘输入
            //type + sit + 帧ID + bool[9]
            int index = 4;
            int sit   = GlobalC.GetSendData_Int(byt, ref index);
            int ID    = GlobalC.GetSendData_Int(byt, ref index);

            bool[] dat = new bool[9];
            for (int i = 0; i < 9; i++)
            {
                dat[i] = GlobalC.GetSendData_Bool(byt, ref index);
            }
            inputManager.SetInput(ID, sit, dat);
        }
Ejemplo n.º 7
0
        private void DealSendData_ChangePlayerType(byte[] byt, int sit)
        {
            //读取玩家类型
            int index = 4;
            int typ   = GlobalC.GetSendData_Int(byt, ref index);

            if (typ > 0 && typ <= 6)
            {
                if (players[sit].player != null)
                {
                    players[sit].player.type = typ;
                }
            }

            //重新发送房间玩家状态
            SendData_PlayerAll();
        }
Ejemplo n.º 8
0
        private void DealSendData(ClientData dat, int sit)
        {
            var byt   = dat.Data;
            int index = 0;
            var typ   = (ClientData.CLIENT_DATA_TYPE)GlobalC.GetSendData_Int(byt, ref index);

            switch (typ)
            {
            case ClientData.CLIENT_DATA_TYPE.ADD_PLAYER:
                DealSendData_AddPlayer(byt, sit);
                break;

            case ClientData.CLIENT_DATA_TYPE.MAP_CHANGE:
                DealSendData_MapChange(byt, sit);
                break;

            case ClientData.CLIENT_DATA_TYPE.TEAM_CHANGE:
                DealSendData_TeamChange(byt, sit);
                break;

            case ClientData.CLIENT_DATA_TYPE.GAME_START:
                DealSendData_GameStart(byt, sit);
                break;

            case ClientData.CLIENT_DATA_TYPE.INPUT:
                DealSendData_Input(byt, sit);
                break;

            case ClientData.CLIENT_DATA_TYPE.CHANGE_DELAY:
                DealSendData_ChangeDelay(dat, sit);
                break;

            case ClientData.CLIENT_DATA_TYPE.CHANGE_ROOM_PREP:
                DealSendData_ChangeRoomPrep(byt, sit);
                break;

            case ClientData.CLIENT_DATA_TYPE.CHANGE_PLAYER_TYPE:
                DealSendData_ChangePlayerType(byt, sit);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 9
0
        private void DealSendData_MapChange(byte[] byt, int sit)
        {
            //判断是否为房主
            if (sit != Boss)
            {
                return;
            }

            //读取地图编号
            int index    = 4;
            int mapIndex = GlobalC.GetSendData_Int(byt, ref index);

            //更新地图
            SetMapIndex(mapIndex);

            //重新发送房间状态
            var dat = GetSendData_All();

            clientS.AddData(dat);
        }
Ejemplo n.º 10
0
        private void DealSendData(ClientData dat)
        {
            var byt   = dat.Data;
            int index = 0;
            var typ   = (ClientData.CLIENT_DATA_TYPE)GlobalC.GetSendData_Int(byt, ref index);

            switch (typ)
            {
            case ClientData.CLIENT_DATA_TYPE.DATA_PLAYER:
                DealSendData_ChangePlayer(byt);
                break;

            case ClientData.CLIENT_DATA_TYPE.DATA_ROOM:
                DealSendData_ChangeRoom(byt);
                break;

            case ClientData.CLIENT_DATA_TYPE.DEL_PLAYER:
                DealSendData_DelPlayer(byt);
                break;

            case ClientData.CLIENT_DATA_TYPE.INPUT:
                DealSendData_Input(byt);
                break;

            case ClientData.CLIENT_DATA_TYPE.GAME_START:
                DealSendData_GameStart(byt);
                break;

            case ClientData.CLIENT_DATA_TYPE.CHANGE_DELAY:
                DealSendData_ChangeDelay(byt);
                break;

            default:
                break;
            }
        }