/// <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> /// Sets the game type /// </summary> public static void SetGameType(Guid id, GameType type) { if (CurrentGameType == type) { return; } var client = ClientHandler.GetById(id); if (client == null) { return; } Console.WriteLine($"{client.Id} | {client.Name} changed the game type from {CurrentGameType} to {type}"); CurrentGameType = type; ClientHandler.Broadcast($"game:type:{type}"); }