Change `PerformancePointsCounter` resolution requirements to be required

All other similar UI components have required dependencies, so this is
mainly to bring things in line with expectations. I am using this fact
in the skin editor to only show components which can be used in the
current editor context (by `try-catch`ing their
`Activator.CreateInstance`).
This commit is contained in:
Dean Herbert 2022-03-15 22:55:47 +09:00
parent e577152d2a
commit ac739c9dae
5 changed files with 19 additions and 4 deletions

View File

@ -18,9 +18,11 @@
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Skinning.Legacy;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osu.Game.Skinning;
using osu.Game.Storyboards;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Visual.Gameplay
{
@ -37,6 +39,9 @@ public class TestSceneBeatmapSkinFallbacks : OsuPlayerTestScene
[Cached(typeof(HealthProcessor))]
private HealthProcessor healthProcessor = new DrainingHealthProcessor(0);
[Cached]
private GameplayState gameplayState = new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset());
protected override bool HasCustomSteps => true;
[Test]

View File

@ -14,6 +14,7 @@
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Skinning;
using osu.Game.Tests.Beatmaps;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Gameplay
@ -30,6 +31,9 @@ public class TestSceneHUDOverlay : OsuManualInputManagerTestScene
[Cached(typeof(HealthProcessor))]
private HealthProcessor healthProcessor = new DrainingHealthProcessor(0);
[Cached]
private GameplayState gameplayState = new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset());
// best way to check without exposing.
private Drawable hideTarget => hudOverlay.KeyCounter;
private FillFlowContainer<KeyCounter> keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType<FillFlowContainer<KeyCounter>>().First();

View File

@ -10,6 +10,7 @@
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Skinning.Editor;
using osu.Game.Tests.Beatmaps;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Gameplay
@ -22,6 +23,9 @@ public class TestSceneSkinEditorMultipleSkins : SkinnableTestScene
[Cached(typeof(HealthProcessor))]
private HealthProcessor healthProcessor = new DrainingHealthProcessor(0);
[Cached]
private GameplayState gameplayState = new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset());
[SetUpSteps]
public void SetUpSteps()
{

View File

@ -15,6 +15,7 @@
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Gameplay
@ -29,6 +30,9 @@ public class TestSceneSkinnableHUDOverlay : SkinnableTestScene
[Cached(typeof(HealthProcessor))]
private HealthProcessor healthProcessor = new DrainingHealthProcessor(0);
[Cached]
private GameplayState gameplayState = new GameplayState(new TestBeatmap(new OsuRuleset().RulesetInfo), new OsuRuleset());
private IEnumerable<HUDOverlay> hudOverlays => CreatedDrawables.OfType<HUDOverlay>();
// best way to check without exposing.

View File

@ -42,12 +42,10 @@ public class PerformancePointsCounter : RollingCounter<int>, ISkinnableDrawable
private const float alpha_when_invalid = 0.3f;
[CanBeNull]
[Resolved(CanBeNull = true)]
[Resolved]
private ScoreProcessor scoreProcessor { get; set; }
[Resolved(CanBeNull = true)]
[CanBeNull]
[Resolved]
private GameplayState gameplayState { get; set; }
[CanBeNull]