diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 83359838aa..fbec6ea1fb 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -90,12 +90,7 @@ namespace osu.Game.Scoring /// /// The to retrieve the bindable for. /// The bindable containing the total score. - public Bindable GetBindableTotalScore([NotNull] ScoreInfo score) - { - var bindable = new TotalScoreBindable(score, this); - configManager?.BindWith(OsuSetting.ScoreDisplayMode, bindable.ScoringMode); - return bindable; - } + public Bindable GetBindableTotalScore([NotNull] ScoreInfo score) => new TotalScoreBindable(score, this, configManager); /// /// Retrieves a bindable that represents the formatted total score string of a . @@ -118,7 +113,11 @@ namespace osu.Game.Scoring public void GetTotalScore([NotNull] ScoreInfo score, [NotNull] Action callback, ScoringMode mode = ScoringMode.Standardised, CancellationToken cancellationToken = default) { GetTotalScoreAsync(score, mode, cancellationToken) - .ContinueWith(task => scheduler.Add(() => callback(task.GetResultSafely())), TaskContinuationOptions.OnlyOnRanToCompletion); + .ContinueWith(task => scheduler.Add(() => + { + if (!cancellationToken.IsCancellationRequested) + callback(task.GetResultSafely()); + }), TaskContinuationOptions.OnlyOnRanToCompletion); } /// @@ -183,8 +182,7 @@ namespace osu.Game.Scoring /// private class TotalScoreBindable : Bindable { - public readonly Bindable ScoringMode = new Bindable(); - + private readonly Bindable scoringMode = new Bindable(); private readonly ScoreInfo score; private readonly ScoreManager scoreManager; @@ -195,12 +193,14 @@ namespace osu.Game.Scoring /// /// The to provide the total score of. /// The . - public TotalScoreBindable(ScoreInfo score, ScoreManager scoreManager) + /// The config. + public TotalScoreBindable(ScoreInfo score, ScoreManager scoreManager, OsuConfigManager configManager) { this.score = score; this.scoreManager = scoreManager; - ScoringMode.BindValueChanged(onScoringModeChanged, true); + configManager?.BindWith(OsuSetting.ScoreDisplayMode, scoringMode); + scoringMode.BindValueChanged(onScoringModeChanged, true); } private void onScoringModeChanged(ValueChangedEvent mode)