public void ExitSpectator(string username) { for (var i = 0; i < SpectateUsers.Count; i++) { if (SpectateUsers[i].Username == username) { SpectateUsers.Remove(SpectateUsers[i]); } } }
public void Spectate(IUser user) { if (!GamePreferences.Spectating) { var e = new Exception("Can't spectate at this room"); Logger.Log(Severity.Exception, e.Message); throw e; } if (user is null) { var e = new Exception("Can't add a null user to the room"); Logger.Log(Severity.Exception, e.Message); throw e; } SpectateUsers.Add(user); }
public IRoom ExitSpectator(IUser user) { if (user is null) { var e = new Exception("Can't add a null user to the room"); Logger.Log(Severity.Exception, e.Message); throw e; } if (!SpectateUsers.Contains(user)) { var e = new Exception("User is not spectate this room"); Logger.Log(Severity.Exception, e.Message); throw e; } SpectateUsers.Remove(user); return(this); }