public async Task ClearMatch() { if (_isRunning) { await EndRound(); } _wsMonitor.DisableScoring(); _wsMonitor.RemoveAllCharacterSubscriptions(); _messageService.DisableLogging(); MatchConfiguration = new MatchConfiguration(); _roundSecondsMax = MatchConfiguration.RoundSecondsTotal; _matchState = MatchState.Uninitialized; _currentRound = 0; _matchDataService.CurrentMatchRound = _currentRound; _matchDataService.CurrentMatchId = string.Empty; _latestTimerTickMessage = null; _teamsManager.ClearAllTeams(); SendMatchStateUpdateMessage(); SendMatchConfigurationUpdateMessage(); }
public async Task ClearMatch(bool isRematch) { if (_isRunning) { await EndRound(); } _wsMonitor.DisableScoring(); if (!isRematch) { _wsMonitor.RemoveAllCharacterSubscriptions(); } _messageService.DisableLogging(); var previousWorldId = MatchConfiguration.WorldIdString; var previousIsManualWorldId = MatchConfiguration.IsManualWorldId; var previousEndRoundOnFacilityCapture = MatchConfiguration.EndRoundOnFacilityCapture; var previousIsManualEndRoundOnFacilityCapture = MatchConfiguration.EndRoundOnFacilityCapture; MatchConfiguration = new MatchConfiguration(); if (isRematch) { MatchConfiguration.TrySetWorldId(previousWorldId, previousIsManualWorldId); MatchConfiguration.TrySetEndRoundOnFacilityCapture(previousEndRoundOnFacilityCapture, previousIsManualEndRoundOnFacilityCapture); } else { var activeRuleset = await _rulesetManager.GetActiveRulesetAsync(); MatchConfiguration.TrySetEndRoundOnFacilityCapture(activeRuleset.DefaultEndRoundOnFacilityCapture, false); } _roundSecondsMax = MatchConfiguration.RoundSecondsTotal; _matchState = MatchState.Uninitialized; _currentRound = 0; _matchDataService.CurrentMatchRound = _currentRound; _matchDataService.CurrentMatchId = string.Empty; _latestTimerTickMessage = null; if (isRematch) { _teamsManager.UpdateAllTeamsMatchSeriesResults(CurrentSeriesMatch); _teamsManager.ResetAllTeamsMatchData(); } else { CurrentSeriesMatch = 0; _teamsManager.ClearAllTeams(); } SendMatchStateUpdateMessage(); SendMatchConfigurationUpdateMessage(); }