1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 16:02:56 +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
parent b7972e3c84
commit 870e4ce27e
No known key found for this signature in database

View File

@ -89,6 +89,13 @@ namespace osu.Game.Screens.Play.HUD
public const float MAIN_PATH_RADIUS = 10f; public const float MAIN_PATH_RADIUS = 10f;
private readonly LayoutValue drawSizeLayout = new LayoutValue(Invalidation.DrawSize);
public ArgonHealthDisplay()
{
AddLayout(drawSizeLayout);
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -134,22 +141,11 @@ namespace osu.Game.Screens.Play.HUD
Current.BindValueChanged(_ => Scheduler.AddOnce(updateCurrent), true); Current.BindValueChanged(_ => Scheduler.AddOnce(updateCurrent), true);
UseRelativeSize.BindValueChanged(v => UseRelativeSize.BindValueChanged(v => RelativeSizeAxes = v.NewValue ? Axes.X : Axes.None, true);
{
RelativeSizeAxes = v.NewValue ? Axes.X : Axes.None;
}, true);
BarHeight.BindValueChanged(_ => updatePath(), 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() private void updateCurrent()
{ {
if (Current.Value >= GlowBarValue) finishMissDisplay(); if (Current.Value >= GlowBarValue) finishMissDisplay();
@ -165,6 +161,12 @@ namespace osu.Game.Screens.Play.HUD
{ {
base.Update(); base.Update();
if (!drawSizeLayout.IsValid)
{
updatePath();
drawSizeLayout.Validate();
}
mainBar.Alpha = (float)Interpolation.DampContinuously(mainBar.Alpha, Current.Value > 0 ? 1 : 0, 40, Time.Elapsed); 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); glowBar.Alpha = (float)Interpolation.DampContinuously(glowBar.Alpha, GlowBarValue > 0 ? 1 : 0, 40, Time.Elapsed);
} }