1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Update start and end progress in one go

This commit is contained in:
Andrei Zavatski 2024-01-12 02:54:04 +03:00
parent bbb36da323
commit 101a26a53e
2 changed files with 11 additions and 31 deletions

View File

@ -249,9 +249,8 @@ namespace osu.Game.Screens.Play.HUD
private void updatePathProgress() private void updatePathProgress()
{ {
mainBar.EndProgress = (float)healthBarValue; mainBar.ProgressRange = new Vector2(0f, (float)healthBarValue);
glowBar.StartProgress = (float)healthBarValue; glowBar.ProgressRange = new Vector2((float)healthBarValue, (float)Math.Max(glowBarValue, healthBarValue));
glowBar.EndProgress = (float)Math.Max(glowBarValue, healthBarValue);
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)

View File

@ -20,32 +20,17 @@ namespace osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts
{ {
public partial class ArgonHealthDisplayBar : Box public partial class ArgonHealthDisplayBar : Box
{ {
private float endProgress = 1f; private Vector2 progressRange = new Vector2(0f, 1f);
public float EndProgress public Vector2 ProgressRange
{ {
get => endProgress; get => progressRange;
set set
{ {
if (endProgress == value) if (progressRange == value)
return; return;
endProgress = value; progressRange = value;
Invalidate(Invalidation.DrawNode);
}
}
private float startProgress;
public float StartProgress
{
get => startProgress;
set
{
if (startProgress == value)
return;
startProgress = value;
Invalidate(Invalidation.DrawNode); Invalidate(Invalidation.DrawNode);
} }
} }
@ -149,8 +134,7 @@ namespace osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts
} }
private Vector2 size; private Vector2 size;
private float startProgress; private Vector2 progressRange;
private float endProgress;
private float pathRadius; private float pathRadius;
private float padding; private float padding;
private float glowPortion; private float glowPortion;
@ -162,8 +146,7 @@ namespace osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts
base.ApplyState(); base.ApplyState();
size = Source.DrawSize; size = Source.DrawSize;
endProgress = Source.endProgress; progressRange = new Vector2(Math.Min(Source.progressRange.X, Source.progressRange.Y), Source.progressRange.Y);
startProgress = Math.Min(Source.startProgress, endProgress);
pathRadius = Source.PathRadius; pathRadius = Source.PathRadius;
padding = Source.PathPadding; padding = Source.PathPadding;
glowPortion = Source.GlowPortion; glowPortion = Source.GlowPortion;
@ -192,8 +175,7 @@ namespace osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts
GlowColour = new Vector4(glowColour.R, glowColour.G, glowColour.B, glowColour.A), GlowColour = new Vector4(glowColour.R, glowColour.G, glowColour.B, glowColour.A),
GlowPortion = glowPortion, GlowPortion = glowPortion,
Size = size, Size = size,
StartProgress = startProgress, ProgressRange = progressRange,
EndProgress = endProgress,
PathRadius = pathRadius, PathRadius = pathRadius,
Padding = padding Padding = padding
}; };
@ -215,8 +197,7 @@ namespace osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts
public UniformVector4 BarColour; public UniformVector4 BarColour;
public UniformVector4 GlowColour; public UniformVector4 GlowColour;
public UniformVector2 Size; public UniformVector2 Size;
public UniformFloat StartProgress; public UniformVector2 ProgressRange;
public UniformFloat EndProgress;
public UniformFloat PathRadius; public UniformFloat PathRadius;
public UniformFloat Padding; public UniformFloat Padding;
public UniformFloat GlowPortion; public UniformFloat GlowPortion;