1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 07:07:45 +08:00

handle IApplicableToDifficulty for CS change.

This commit is contained in:
cdwcgt 2024-08-10 18:14:45 +08:00
parent 84c0bd0052
commit 20921577d7
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2

View File

@ -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<WorkingBeatmap> beatmap)
private void load(IBindable<WorkingBeatmap> 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<IApplicableToDifficulty>())
{
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);