From 92e53fac28a5fb848e9a844c2d37bb8473efa6a5 Mon Sep 17 00:00:00 2001 From: normalid Date: Thu, 4 Jul 2024 14:50:57 +0800 Subject: [PATCH] Make the min, max rank property to IBindable, so that they can't modify from outside --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 1d238cbbda..144c257027 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -99,14 +99,18 @@ namespace osu.Game.Rulesets.Scoring private readonly Bindable rank = new Bindable(ScoreRank.X); /// - /// Using the minimum accuracy as the data source to calculate the minimum rank. + /// The minimum-achievable rank. /// - public readonly Bindable MinimumRank = new Bindable(ScoreRank.X); + public IBindable MinimumRank => minimumRank; + + private readonly Bindable minimumRank = new Bindable(ScoreRank.D); /// - /// Using the maximum accuracy as the data source to calculate the minimum rank. + /// The maximum-achievable rank. /// - public readonly Bindable MaximumRank = new Bindable(ScoreRank.X); + public IBindable MaximumRank => maximumRank; + + private readonly Bindable maximumRank = new Bindable(ScoreRank.X); /// /// The highest combo achieved by this score. @@ -407,8 +411,8 @@ namespace osu.Game.Rulesets.Scoring } rank.Value = newRank; - MaximumRank.Value = newMaxRank; - MinimumRank.Value = newMinRank; + maximumRank.Value = newMaxRank; + minimumRank.Value = newMinRank; } protected virtual double ComputeTotalScore(double comboProgress, double accuracyProgress, double bonusPortion)