public void RemovePlayer(SdlPlayer player) { this.players.Remove(player); if (this.Captain.Equals(player)) { this.Captain = this.players.OrderByDescending(e => e.PowerLevel).First(); } }
public void AddPlayer(SdlPlayer player, bool asCaptain = false) { this.players.Add(player); if (asCaptain) { this.Captain = player; } }
public void AddPlayer(SdlPlayer player, bool force = false) { if (!force && (this.IsFull || this.players.Any(e => e.DiscordId == player.DiscordId))) { return; } if (!this.players.Any()) { this.StartTime = DateTime.Now; this.TimeRemaining = TimeSpan.FromMinutes(20); } this.players.Add(player); if (!this.stalePlayers.Contains(player.DiscordId)) { switch (this.players.Count) { case 1: case 2: case 3: case 4: this.TimeRemaining += TimeSpan.FromMinutes(5); break; case 5: case 6: this.TimeRemaining += TimeSpan.FromMinutes(10); break; case 7: this.TimeRemaining += TimeSpan.FromMinutes(20); break; } if (this.TimeRemaining > TimeSpan.FromMinutes(20)) { this.TimeRemaining = TimeSpan.FromMinutes(20); } this.stalePlayers.Add(player.DiscordId); } this.LastUpdate = DateTime.Now; this.timer.Stop(); this.timer.Start(); }
public void RemovePlayer(SdlPlayer player) { if (this.players.Contains(player)) { this.players.Remove(player); } if (this.players.Count == 0) { this.Close(); } else if (!this.IsFull && !this.timer.Enabled) { this.timer.Start(); } }
public void Clear() { this.players.Clear(); this.Captain = null; this.OrderedMatchResults.Clear(); }