コード例 #1
0
        public static unsafe void SendRoomCreateRequest(int playerID)
        {
            PacketStruct.RoomCreateRequest request = new PacketStruct.RoomCreateRequest();
            request.m_Size     = (short)sizeof(PacketStruct.RoomCreateRequest);
            request.m_Type     = (short)PacketTypes.PKT_CS_ROOM_CREATE;
            request.m_PlayerId = playerID;

            byte[] sendData = RawSerializer <PacketStruct.RoomCreateRequest> .RawSerialize(request);

            socket.Send(sendData, 0, sendData.Length, SocketFlags.None);
        }
コード例 #2
0
        public static unsafe void SendLeaveRoomRequest(int roomNumber)
        {
            PacketStruct.LeaveRoomRequest request = new PacketStruct.LeaveRoomRequest();
            request.m_Size       = (short)sizeof(PacketStruct.LeaveRoomRequest);
            request.m_Type       = (short)PacketTypes.PKT_CS_LEAVE_ROOM;
            request.m_RoomNumber = roomNumber;

            byte[] sendData = RawSerializer <PacketStruct.LeaveRoomRequest> .RawSerialize(request);

            socket.Send(sendData, 0, sendData.Length, SocketFlags.None);
        }
コード例 #3
0
        public static unsafe void SendStopCorpsRequest(
            int corpsID)
        {
            PacketStruct.StopCorpsRequest request = new PacketStruct.StopCorpsRequest();
            request.m_Size    = (short)sizeof(PacketStruct.StopCorpsRequest);
            request.m_Type    = (short)PacketTypes.PKT_CS_STOP_CORPS;
            request.m_CorpsID = corpsID;

            byte[] sendData = RawSerializer <PacketStruct.StopCorpsRequest> .RawSerialize(request);

            socket.Send(sendData, 0, sendData.Length, SocketFlags.None);
        }
コード例 #4
0
        public static unsafe void SendGameOverRequest(int playerID, bool isWon)
        {
            PacketStruct.GameOverRequest request = new PacketStruct.GameOverRequest();
            request.m_Size     = (short)sizeof(PacketStruct.GameOverRequest);
            request.m_Type     = (short)PacketTypes.PKT_CS_GAMEOVER;
            request.m_PlayerId = playerID;
            request.m_IsWon    = isWon;

            byte[] sendData = RawSerializer <PacketStruct.GameOverRequest> .RawSerialize(request);

            socket.Send(sendData, 0, sendData.Length, SocketFlags.None);
        }
コード例 #5
0
        public static unsafe bool SendLoginRequest(int playerID)
        {
            PacketStruct.LoginRequest loginRequest = new PacketStruct.LoginRequest();
            loginRequest.m_Size     = (short)sizeof(PacketStruct.LoginRequest);
            loginRequest.m_Type     = (short)PacketTypes.PKT_CS_LOGIN;
            loginRequest.m_PlayerId = playerID;
            byte[] sendData = RawSerializer <PacketStruct.LoginRequest> .RawSerialize(loginRequest);

            socket.Send(sendData, 0, sendData.Length, SocketFlags.None);

            // receive를 넣어서 결과 처리해줄려했는데 귀찮다. 일단 그냥 송신만
            return(true);
        }
コード例 #6
0
        public static unsafe void AttackCorpsRequest(
            int corpsIDFrom, int corpsIDTo)
        {
            PacketStruct.AttackCorpsRequest request = new PacketStruct.AttackCorpsRequest();
            request.m_Size          = (short)sizeof(PacketStruct.AttackCorpsRequest);
            request.m_Type          = (short)PacketTypes.PKT_CS_CORPS_ATTACK;
            request.m_MyCorpsID     = corpsIDFrom;
            request.m_TargetCorpsID = corpsIDTo;

            byte[] sendData = RawSerializer <PacketStruct.AttackCorpsRequest> .RawSerialize(request);

            socket.Send(sendData, 0, sendData.Length, SocketFlags.None);
        }
コード例 #7
0
        public static unsafe void SendChangeCorpsFormationRequest(
            int corpsID
            , byte formationType)
        {
            PacketStruct.ChangeCorpsFormationRequest request = new PacketStruct.ChangeCorpsFormationRequest();
            request.m_Size          = (short)sizeof(PacketStruct.ChangeCorpsFormationRequest);
            request.m_Type          = (short)PacketTypes.PKT_CS_CORPS_CHANGE_FORMATION;
            request.m_CorpsID       = corpsID;
            request.m_FormationType = formationType;

            byte[] sendData = RawSerializer <PacketStruct.ChangeCorpsFormationRequest> .RawSerialize(request);

            socket.Send(sendData, 0, sendData.Length, SocketFlags.None);
        }
コード例 #8
0
        public static unsafe void SendMoveCorpsRequest(
            int corpsID
            , float eyeX
            , float eyeZ
            , float lookX
            , float lookZ)
        {
            PacketStruct.MoveCorpsRequest request = new PacketStruct.MoveCorpsRequest();
            request.m_Size    = (short)sizeof(PacketStruct.MoveCorpsRequest);
            request.m_Type    = (short)PacketTypes.PKT_CS_MOVE_CORPS;
            request.m_CorpsID = corpsID;
            request.m_EyeX    = eyeX;
            request.m_EyeZ    = eyeZ;
            request.m_LookX   = lookX;
            request.m_LookZ   = lookZ;

            byte[] sendData = RawSerializer <PacketStruct.MoveCorpsRequest> .RawSerialize(request);

            socket.Send(sendData, 0, sendData.Length, SocketFlags.None);
        }
コード例 #9
0
        public static unsafe void SendGenerateCorpsRequest(
            byte unitType
            , float eyeX
            , float eyeZ
            , float lookX
            , float lookZ
            , int playerID)
        {
            PacketStruct.GenerateCorpsRequest request = new PacketStruct.GenerateCorpsRequest();
            request.m_Size     = (short)sizeof(PacketStruct.GenerateCorpsRequest);
            request.m_Type     = (short)PacketTypes.PKT_CS_GENERATE_CORPS;
            request.m_UnitType = unitType;
            request.m_EyeX     = eyeX;
            request.m_EyeZ     = eyeZ;
            request.m_LookX    = lookX;
            request.m_LookZ    = lookZ;
            request.m_PlayerId = playerID;

            byte[] sendData = RawSerializer <PacketStruct.GenerateCorpsRequest> .RawSerialize(request);

            socket.Send(sendData, 0, sendData.Length, SocketFlags.None);
        }