1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 00:53:22 +08:00

Bind every HealthDisplay on Player load

This commit is contained in:
Lucas A 2020-03-17 22:57:47 +01:00
parent 6b0c5bc65d
commit ed4f9f8ba9
4 changed files with 19 additions and 0 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Input;
using osu.Game.Beatmaps;
using osu.Game.Input.Handlers;
@ -16,6 +17,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Replays;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osuTK;
namespace osu.Game.Rulesets.Osu.UI
@ -29,6 +31,12 @@ namespace osu.Game.Rulesets.Osu.UI
{
}
[BackgroundDependencyLoader]
private void load()
{
Overlays.Add(new FaillingLayer());
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; // always show the gameplay cursor
protected override Playfield CreatePlayfield() => new OsuPlayfield();

View File

@ -25,6 +25,7 @@ namespace osu.Game.Screens.Play.HUD
public FaillingLayer()
{
RelativeSizeAxes = Axes.Both;
Child = box = new Box
{
RelativeSizeAxes = Axes.Both,

View File

@ -3,6 +3,7 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Screens.Play.HUD
{
@ -13,5 +14,10 @@ namespace osu.Game.Screens.Play.HUD
MinValue = 0,
MaxValue = 1
};
public virtual void BindHealthProcessor(HealthProcessor processor)
{
Current.BindTo(processor.Health);
}
}
}

View File

@ -24,6 +24,7 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Ranking;
using osu.Game.Skinning;
using osu.Game.Users;
@ -184,6 +185,9 @@ namespace osu.Game.Screens.Play
foreach (var mod in Mods.Value.OfType<IApplicableToHealthProcessor>())
mod.ApplyToHealthProcessor(HealthProcessor);
foreach (var overlay in DrawableRuleset.Overlays.OfType<HealthDisplay>())
overlay.BindHealthProcessor(HealthProcessor);
BreakOverlay.IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
}