mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Move implementation to HUD
This commit is contained in:
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
@ -48,6 +49,17 @@ namespace osu.Game.Screens.Play.HUD
|
||||
enabled.BindValueChanged(e => this.FadeTo(e.NewValue ? 1 : 0, fade_time, Easing.OutQuint), true);
|
||||
}
|
||||
|
||||
public override void BindHealthProcessor(HealthProcessor processor)
|
||||
{
|
||||
base.BindHealthProcessor(processor);
|
||||
|
||||
if (!(processor is DrainingHealthProcessor))
|
||||
{
|
||||
enabled.UnbindBindings();
|
||||
enabled.Value = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
box.Alpha = (float)Interpolation.ValueAt(Math.Clamp(Clock.ElapsedFrameTime, 0, fade_time), box.Alpha,
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
/// <summary>
|
||||
/// Bind the tracked fields of <see cref="HealthProcessor"/> to this health display.
|
||||
/// </summary>
|
||||
public void BindHealthProcessor(HealthProcessor processor)
|
||||
public virtual void BindHealthProcessor(HealthProcessor processor)
|
||||
{
|
||||
Current.BindTo(processor.Health);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ namespace osu.Game.Screens.Play
|
||||
public readonly HitErrorDisplay HitErrorDisplay;
|
||||
public readonly HoldForMenuButton HoldToQuit;
|
||||
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
||||
public readonly FailingLayer FailingLayer;
|
||||
|
||||
public Bindable<bool> ShowHealthbar = new Bindable<bool>(true);
|
||||
|
||||
@ -75,6 +76,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
FailingLayer = CreateFailingLayer(),
|
||||
visibilityContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -260,6 +262,8 @@ namespace osu.Game.Screens.Play
|
||||
Margin = new MarginPadding { Top = 20 }
|
||||
};
|
||||
|
||||
protected virtual FailingLayer CreateFailingLayer() => new FailingLayer();
|
||||
|
||||
protected virtual KeyCounterDisplay CreateKeyCounter() => new KeyCounterDisplay
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
@ -304,7 +308,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected virtual void BindHealthProcessor(HealthProcessor processor)
|
||||
{
|
||||
HealthDisplay?.Current.BindTo(processor.Health);
|
||||
HealthDisplay?.BindHealthProcessor(processor);
|
||||
FailingLayer?.BindHealthProcessor(processor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user