internal void AddLobbies(List<string> strings) { lock (Lobbies) { foreach (string str in strings) { if (!Lobbies.ContainsKey(str)) Lobbies.Add(str, new ClientLobby(str, this)); } lock (CurrentLobbyLock) { if (CurrentLobby == null) { CurrentLobby = (ClientLobby)Lobbies["/"]; } } } if (LobbiesAdded != null) LobbiesAdded(this, EventArgs.Empty); }
internal void AddPlayersToLobby(List<string> playerNames, string lobbyName) { lock (Lobbies) { lock (CurrentLobbyLock) { if (CurrentLobby == null || CurrentLobby.Name != lobbyName) CurrentLobby = (ClientLobby)Lobbies[lobbyName]; CurrentLobby.ClearPlayers(); foreach (string playerName in playerNames) CurrentLobby.AddPlayer(playerName); } } if (PlayersAddedToCurrentLobby != null) PlayersAddedToCurrentLobby(this, EventArgs.Empty); }
internal void AddGamesToLobby(List<string> gameOwnerNames, string lobbyName) { lock (Lobbies) { lock (CurrentLobbyLock) { if (CurrentLobby == null || CurrentLobby.Name != lobbyName) CurrentLobby = (ClientLobby)Lobbies[lobbyName]; CurrentLobby.ClearGames(); foreach (string gameOwnerName in gameOwnerNames) CurrentLobby.AddGame(gameOwnerName); } } if (GamesAddedToCurrentLobby != null) GamesAddedToCurrentLobby(this, EventArgs.Empty); }