[ADD] added sending the lobbies data from the server to the clients on startup
This commit is contained in:
@@ -123,6 +123,13 @@ namespace Server.Models
|
||||
case JSONConvert.LOBBY:
|
||||
// lobby data
|
||||
LobbyIdentifier l = JSONConvert.GetLobbyIdentifier(payload);
|
||||
switch(l)
|
||||
{
|
||||
case LobbyIdentifier.REQUEST:
|
||||
Debug.WriteLine("[SERVERCLIENT] got lobby request message, sending lobbies...");
|
||||
sendMessage(JSONConvert.ConstructLobbyListMessage(ServerCommunication.INSTANCE.lobbies.ToArray()));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case JSONConvert.CANVAS:
|
||||
// canvas data
|
||||
@@ -132,7 +139,6 @@ namespace Server.Models
|
||||
Debug.WriteLine("[SERVER] Received weird identifier: " + id);
|
||||
break;
|
||||
}
|
||||
//TODO implement ways to handle the message
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace Server.Models
|
||||
listener = new TcpListener(IPAddress.Any, port);
|
||||
serverClients = new List<ServerClient>();
|
||||
lobbies = new List<Lobby>();
|
||||
lobbies.Add(new Lobby(1,1,1));
|
||||
lobbies.Add(new Lobby(2, 2, 2));
|
||||
lobbies.Add(new Lobby(3, 3, 3));
|
||||
serverClientsInlobbies = new Dictionary<Lobby, List<ServerClient>>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user