From 4df63a4900897c6811a2a233b1602acbe3be6bb0 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 30 Mar 2022 13:15:41 +0900 Subject: [PATCH] Prevent scores being calculated twice --- osu.Game/Scoring/ScoreManager.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 113886dbd7..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 . @@ -187,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; @@ -199,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)