[ADD] added that when you join an empty lobby you become the host

This commit is contained in:
Sem van der Hoeven
2020-10-22 13:22:52 +02:00
parent 471247827b
commit 0b72c4dc9b
5 changed files with 22 additions and 10 deletions

View File

@@ -133,9 +133,16 @@ namespace SharedClientServer
return dynamicAsObject.ToObject<Lobby>();
}
public static byte[] ConstructLobbyJoinSuccessMessage()
public static byte[] ConstructLobbyJoinSuccessMessage(bool isHost)
{
return GetMessageToSend(LOBBY, new { identifier = LobbyIdentifier.JOIN_SUCCESS});
return GetMessageToSend(LOBBY, new { identifier = LobbyIdentifier.JOIN_SUCCESS,
host = isHost});
}
public static bool GetLobbyJoinIsHost(byte[] json)
{
dynamic payload = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json));
return payload.host;
}
#endregion