mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Update HealthDisplay
components to use DI to attach data source
This commit is contained in:
@ -47,7 +47,6 @@ namespace osu.Game.Screens.Play
|
||||
public Bindable<bool> ShowHealthbar = new Bindable<bool>(true);
|
||||
|
||||
private readonly ScoreProcessor scoreProcessor;
|
||||
private readonly HealthProcessor healthProcessor;
|
||||
private readonly DrawableRuleset drawableRuleset;
|
||||
private readonly IReadOnlyList<Mod> mods;
|
||||
|
||||
@ -75,10 +74,9 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter, topRightElements };
|
||||
|
||||
public HUDOverlay(ScoreProcessor scoreProcessor, HealthProcessor healthProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
||||
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
||||
{
|
||||
this.scoreProcessor = scoreProcessor;
|
||||
this.healthProcessor = healthProcessor;
|
||||
this.drawableRuleset = drawableRuleset;
|
||||
this.mods = mods;
|
||||
|
||||
@ -161,9 +159,6 @@ namespace osu.Game.Screens.Play
|
||||
if (scoreProcessor != null)
|
||||
BindScoreProcessor(scoreProcessor);
|
||||
|
||||
if (healthProcessor != null)
|
||||
BindHealthProcessor(healthProcessor);
|
||||
|
||||
if (drawableRuleset != null)
|
||||
{
|
||||
BindDrawableRuleset(drawableRuleset);
|
||||
@ -322,21 +317,6 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
ScoreCounter?.Current.BindTo(processor.TotalScore);
|
||||
AccuracyCounter?.Current.BindTo(processor.Accuracy);
|
||||
|
||||
if (HealthDisplay is IHealthDisplay shd)
|
||||
{
|
||||
processor.NewJudgement += judgement =>
|
||||
{
|
||||
if (judgement.IsHit && judgement.Type != HitResult.IgnoreHit)
|
||||
shd.Flash(judgement);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void BindHealthProcessor(HealthProcessor processor)
|
||||
{
|
||||
HealthDisplay?.BindHealthProcessor(processor);
|
||||
FailingLayer?.BindHealthProcessor(processor);
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
|
Reference in New Issue
Block a user