[ADDED] a begin for the turn base

This commit is contained in:
Lars
2020-10-23 16:46:29 +02:00
parent eee4f0347f
commit 13cf0e44ee
7 changed files with 82 additions and 7 deletions

View File

@@ -208,12 +208,14 @@ namespace Server.Models
lobbyTimer.Elapsed += LobbyTimer_Elapsed;
lobbyTimer.Start();
ServerCommunication.INSTANCE.sendToAll(JSONConvert.ConstructLobbyListMessage(ServerCommunication.INSTANCE.lobbies.ToArray()));
serverCom.SendToLobby(lobbyID, JSONConvert.ConstructGameInitializeData( serverCom.FindUserNameInLobby(lobbyID),lobbyID));
break;
case GameCommand.TIMER_ELAPSED:
break;
case GameCommand.NEXT_ROUND:
// The next round has been started, so we can start the timer again
lobbyID = JSONConvert.GetLobbyID(payload);
foreach (System.Timers.Timer timer in lobbyTimers.Keys)
{

View File

@@ -298,8 +298,24 @@ namespace Server.Models
if (lobby.ID == lobbyID)
{
lobby.LobbyJoinable = false;
break;
}
}
}
public string FindUserNameInLobby(int lobbyID)
{
Lobby lobbyFound = null;
foreach (Lobby lobby in lobbies)
{
if (lobby.ID == lobbyID)
{
lobbyFound = lobby;
break;
}
}
return lobbyFound?.Users[lobbyFound.UserDrawing]?.Username;
}
}
}