public static void CreateLobby(String roomName, uint playerLimit, ulong waitTime, Game.GAME_TYPE game) { //check if lobby name is unique lobbyListMutex.WaitOne(); foreach (Lobby l in lobbys) { if (l.Name == roomName) { throw new Exception("Nazwa lobby zajeta!"); } } lobbyListMutex.ReleaseMutex(); Game tempG; switch (game) { case Game.GAME_TYPE.BOMBERMAN: tempG = new Game_Bomberman(); break; default: tempG = new Game_Bomberman(); break; } gameListMutex.WaitOne(); games.Add(tempG); uint gameID = (uint)games.Count() - 1; gameListMutex.ReleaseMutex(); Lobby tempL = new Lobby(roomName, playerLimit, waitTime, gameID, game); lobbyListMutex.WaitOne(); lobbys.Add(tempL); lobbyListMutex.ReleaseMutex(); }
public static void CreateLobby(String roomName, Game.GAME_TYPE game) { CreateLobby(roomName, DEFAULT_PLAYER_LIMIT, DEFAULT_LOBBY_WAIT_TIME, game); }