Ejemplo n.º 1
0
 public static Response parseAllowJoinRoom(MessageBuffer msg)
 {
     msg.reset();
       Int32 size = msg.popInt();
       Int16 action = msg.popShort();
       Int16 numPlayers = msg.popShort();
       string roomName = msg.popString();
       List<string> playerNames = new List<string>(numPlayers);
       for (int i = 0; i < numPlayers; i++)
     playerNames.Add(msg.popString());
       return new RoomJoinedResponse(roomName, playerNames, numPlayers);
 }
Ejemplo n.º 2
0
 public static Response parseDenyJoinRoom(MessageBuffer msg)
 {
     msg.reset();
       Int32 size = msg.popInt();
       Int16 action = msg.popShort();
       string roomName = msg.popString();
       return new RoomNotJoinedResponse(roomName);
 }
Ejemplo n.º 3
0
 public static Response parseCreateRoom(MessageBuffer msg)
 {
     msg.reset();
       Int32 size = msg.popInt();
       Int16 action = msg.popShort();
       Int16 result = msg.popShort();
       string roomName = msg.popString();
       return new RoomCreatedResponse(result, roomName);
 }
Ejemplo n.º 4
0
 public static Response parseLeaveRoom(MessageBuffer msg)
 {
     msg.reset();
       Int32 size = msg.popInt();
       Int16 action = msg.popShort();
       string userName = msg.popString();
       string roomName = msg.popString();
       return new PlayerLeftRoomResponse(userName, roomName);
 }
Ejemplo n.º 5
0
 public static Response parseStartGame(MessageBuffer msg)
 {
     msg.reset();
       Int32 size = msg.popInt();
       Int16 action = msg.popShort();
       Int16 numPlayers = msg.popShort();
       List<Int16> playerIds = new List<Int16>(numPlayers);
       for (int i = 0; i < numPlayers; i++)
     playerIds.Add(msg.popShort());
       List<string> playerNames = new List<string>(numPlayers);
       for (int i = 0; i < numPlayers; i++)
     playerNames.Add(msg.popString());
       string map = msg.popString();
       return new StartGameResponse(playerNames, map);
 }
Ejemplo n.º 6
0
        public static Response parseSendAvailableRooms(MessageBuffer msg)
        {
            msg.reset();
              Int32 size = msg.popInt();
              Int16 action = msg.popShort();
              Int16 numRooms = msg.popShort();
              List<string> roomNames = new List<string>(numRooms);
              for (int i = 0; i < numRooms; i++)
            roomNames.Add(msg.popString());

              List<Room> rooms = new List<Room>(numRooms);
              for (int i = 0; i < numRooms; i++)
            rooms.Add(new Room(roomNames[i], 2));
              return new RoomsAvailableResponse(rooms);
        }