From 20921577d72d5555666c4c5f103bee6101733cf2 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Sat, 10 Aug 2024 18:14:45 +0800 Subject: [PATCH] handle IApplicableToDifficulty for CS change. --- osu.Game.Rulesets.Osu/HUD/AimErrorMeter.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/HUD/AimErrorMeter.cs b/osu.Game.Rulesets.Osu/HUD/AimErrorMeter.cs index af687b59e7..8bf9381907 100644 --- a/osu.Game.Rulesets.Osu/HUD/AimErrorMeter.cs +++ b/osu.Game.Rulesets.Osu/HUD/AimErrorMeter.cs @@ -15,10 +15,12 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Localisation.HUD; using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Legacy; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Statistics; +using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play.HUD.HitErrorMeters; using osuTK; using osuTK.Graphics; @@ -84,7 +86,7 @@ namespace osu.Game.Rulesets.Osu.HUD } [BackgroundDependencyLoader] - private void load(IBindable beatmap) + private void load(IBindable beatmap, ScoreProcessor processor) { InternalChild = new Container { @@ -260,7 +262,21 @@ namespace osu.Game.Rulesets.Osu.HUD } }; - objectRadius = OsuHitObject.OBJECT_RADIUS * LegacyRulesetExtensions.CalculateScaleFromCircleSize(beatmap.Value.Beatmap.Difficulty.CircleSize, true); + // handle IApplicableToDifficulty for CS change. + BeatmapDifficulty newDifficulty = new BeatmapDifficulty(); + beatmap.Value.Beatmap.Difficulty.CopyTo(newDifficulty); + + var mods = processor.Mods.Value; + + if (mods.Any(m => m is IApplicableToDifficulty)) + { + foreach (var mod in mods.OfType()) + { + mod.ApplyToDifficulty(newDifficulty); + } + } + + objectRadius = OsuHitObject.OBJECT_RADIUS * LegacyRulesetExtensions.CalculateScaleFromCircleSize(newDifficulty.CircleSize, true); AverageSize.BindValueChanged(size => averagePositionContainer.Size = new Vector2(size.NewValue), true); AverageStyle.BindValueChanged(style => averagePositionRotateContainer.Rotation = style.NewValue == HitStyle.Plus ? 0 : 45, true);