[ADDITION] Tried to send the random word to a lobby
This commit is contained in:
@@ -152,6 +152,10 @@ namespace Server.Models
|
||||
// canvas data
|
||||
// todo send canvas data to all other serverclients in lobby
|
||||
break;
|
||||
|
||||
case JSONConvert.RANDOMWORD:
|
||||
//Flag byte for receiving the random word.
|
||||
break;
|
||||
default:
|
||||
Debug.WriteLine("[SERVER] Received weird identifier: " + id);
|
||||
break;
|
||||
@@ -177,8 +181,13 @@ namespace Server.Models
|
||||
int id = JSONConvert.GetLobbyID(payload);
|
||||
ServerCommunication.INSTANCE.JoinLobby(this.User,id);
|
||||
sendMessage(JSONConvert.ConstructLobbyJoinSuccessMessage());
|
||||
|
||||
serverCom.SendToLobby(serverCom.GetLobbyForUser(User), JSONConvert.GetMessageToSend(RANDOMWORD, new
|
||||
{
|
||||
word = JSONConvert.SendRandomWord("WordsForGame.json")
|
||||
}));
|
||||
|
||||
ServerCommunication.INSTANCE.sendToAll(JSONConvert.ConstructLobbyListMessage(ServerCommunication.INSTANCE.lobbies.ToArray()));
|
||||
Debug.WriteLine("Random chosen word: {0}", JSONConvert.GetRandomWord(@"..\resources\WordsForGame.json"));
|
||||
break;
|
||||
case LobbyIdentifier.LEAVE:
|
||||
id = JSONConvert.GetLobbyID(payload);
|
||||
|
||||
@@ -142,6 +142,7 @@ namespace Server.Models
|
||||
{
|
||||
foreach (ServerClient sc in serverClientsInlobbies[l])
|
||||
{
|
||||
Debug.WriteLine("[SERVERCLIENT] Sending message");
|
||||
sc.sendMessage(message);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user