/// <summary> /// Adds a spectator /// </summary> public static void AddSpectator(Guid id) { var client = ClientHandler.GetById(id); if (client == null) { return; } if (Spectators.Contains(client)) { return; } if (Participants.Contains(client)) { Console.WriteLine($"Removed {client.Id}|{client.Name} from the game of {CurrentGameType} as Participant"); ClientHandler.BroadcastServerMessage($"{client.Name} has left the game."); Participants.Remove(client); } Spectators.Add(client); Console.WriteLine($"Spectator {client.Id}|{client.Name} added to the game of {CurrentGameType}"); ClientHandler.BroadcastServerMessage($"{client.Name} is now spectating."); }
/// <summary> /// Adds a participant /// </summary> public static void AddParticipant(Client client) { if (Participants.Contains(client)) { return; } if (Spectators.Contains(client)) { Console.WriteLine($"Removed {client.Id}|{client.Name} from the game of {CurrentGameType} as Spectator"); ClientHandler.BroadcastServerMessage($"{client.Name} is no longer spectating."); Spectators.Remove(client); } Participants.Add(client); Console.WriteLine($"Participant {client.Id}|{client.Name} added to the game of {CurrentGameType}"); ClientHandler.BroadcastServerMessage($"{client.Name} has joined the game."); }