1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-21 23:51:01 +08:00

Fix argon health display not handling invalidation correctly

This commit is contained in:
Bartłomiej Dach
2023-11-11 20:42:45 +09:00
Unverified
parent b7972e3c84
commit 870e4ce27e
+14 -12
View File
@@ -89,6 +89,13 @@ namespace osu.Game.Screens.Play.HUD
public const float MAIN_PATH_RADIUS = 10f;
private readonly LayoutValue drawSizeLayout = new LayoutValue(Invalidation.DrawSize);
public ArgonHealthDisplay()
{
AddLayout(drawSizeLayout);
}
[BackgroundDependencyLoader]
private void load()
{
@@ -134,22 +141,11 @@ namespace osu.Game.Screens.Play.HUD
Current.BindValueChanged(_ => Scheduler.AddOnce(updateCurrent), true);
UseRelativeSize.BindValueChanged(v =>
{
RelativeSizeAxes = v.NewValue ? Axes.X : Axes.None;
}, true);
UseRelativeSize.BindValueChanged(v => RelativeSizeAxes = v.NewValue ? Axes.X : Axes.None, true);
BarHeight.BindValueChanged(_ => updatePath(), true);
}
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
{
if ((invalidation & Invalidation.DrawSize) > 0)
updatePath();
return base.OnInvalidate(invalidation, source);
}
private void updateCurrent()
{
if (Current.Value >= GlowBarValue) finishMissDisplay();
@@ -165,6 +161,12 @@ namespace osu.Game.Screens.Play.HUD
{
base.Update();
if (!drawSizeLayout.IsValid)
{
updatePath();
drawSizeLayout.Validate();
}
mainBar.Alpha = (float)Interpolation.DampContinuously(mainBar.Alpha, Current.Value > 0 ? 1 : 0, 40, Time.Elapsed);
glowBar.Alpha = (float)Interpolation.DampContinuously(glowBar.Alpha, GlowBarValue > 0 ? 1 : 0, 40, Time.Elapsed);
}