1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-14 04:12:55 +08:00

Move KeysPerSecondCalculator instantiation from HUDOverlay to Player

This prevents messing with *future* Skin (de)serialization
This commit is contained in:
Ryuki 2022-08-11 10:37:06 +02:00
parent 3c6461b9e4
commit 787dee249d
No known key found for this signature in database
GPG Key ID: A353889EAEACBF49
2 changed files with 11 additions and 3 deletions

View File

@ -50,8 +50,7 @@ namespace osu.Game.Screens.Play
public readonly HoldForMenuButton HoldToQuit;
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
[Cached]
private readonly KeysPerSecondCalculator keysPerSecondCalculator;
private KeysPerSecondCalculator keysPerSecondCalculator;
public Bindable<bool> ShowHealthBar = new Bindable<bool>(true);
@ -131,8 +130,10 @@ namespace osu.Game.Screens.Play
}
[BackgroundDependencyLoader(true)]
private void load(OsuConfigManager config, INotificationOverlay notificationOverlay)
private void load(OsuConfigManager config, INotificationOverlay notificationOverlay, KeysPerSecondCalculator calculator)
{
keysPerSecondCalculator = calculator;
if (drawableRuleset != null)
{
BindDrawableRuleset(drawableRuleset);

View File

@ -34,6 +34,7 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
using osu.Game.Screens.Play.HUD.KeysPerSecond;
using osu.Game.Screens.Ranking;
using osu.Game.Skinning;
using osu.Game.Users;
@ -122,6 +123,8 @@ namespace osu.Game.Screens.Play
private SkipOverlay skipIntroOverlay;
private SkipOverlay skipOutroOverlay;
protected KeysPerSecondCalculator KeysPerSecondCalculator { get; private set; }
protected ScoreProcessor ScoreProcessor { get; private set; }
protected HealthProcessor HealthProcessor { get; private set; }
@ -226,6 +229,9 @@ namespace osu.Game.Screens.Play
dependencies.CacheAs(ScoreProcessor);
KeysPerSecondCalculator = new KeysPerSecondCalculator();
dependencies.CacheAs(KeysPerSecondCalculator);
HealthProcessor = ruleset.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
HealthProcessor.ApplyBeatmap(playableBeatmap);
@ -442,6 +448,7 @@ namespace osu.Game.Screens.Play
OnRetry = Restart,
OnQuit = () => PerformExit(true),
},
KeysPerSecondCalculator
},
};