1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:32:55 +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()
{
mainBar.EndProgress = (float)healthBarValue;
glowBar.StartProgress = (float)healthBarValue;
glowBar.EndProgress = (float)Math.Max(glowBarValue, healthBarValue);
mainBar.ProgressRange = new Vector2(0f, (float)healthBarValue);
glowBar.ProgressRange = new Vector2((float)healthBarValue, (float)Math.Max(glowBarValue, healthBarValue));
}
protected override void Dispose(bool isDisposing)

View File

@ -20,32 +20,17 @@ namespace osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts
{
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
{
if (endProgress == value)
if (progressRange == value)
return;
endProgress = value;
Invalidate(Invalidation.DrawNode);
}
}
private float startProgress;
public float StartProgress
{
get => startProgress;
set
{
if (startProgress == value)
return;
startProgress = value;
progressRange = value;
Invalidate(Invalidation.DrawNode);
}
}
@ -149,8 +134,7 @@ namespace osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts
}
private Vector2 size;
private float startProgress;
private float endProgress;
private Vector2 progressRange;
private float pathRadius;
private float padding;
private float glowPortion;
@ -162,8 +146,7 @@ namespace osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts
base.ApplyState();
size = Source.DrawSize;
endProgress = Source.endProgress;
startProgress = Math.Min(Source.startProgress, endProgress);
progressRange = new Vector2(Math.Min(Source.progressRange.X, Source.progressRange.Y), Source.progressRange.Y);
pathRadius = Source.PathRadius;
padding = Source.PathPadding;
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),
GlowPortion = glowPortion,
Size = size,
StartProgress = startProgress,
EndProgress = endProgress,
ProgressRange = progressRange,
PathRadius = pathRadius,
Padding = padding
};
@ -215,8 +197,7 @@ namespace osu.Game.Screens.Play.HUD.ArgonHealthDisplayParts
public UniformVector4 BarColour;
public UniformVector4 GlowColour;
public UniformVector2 Size;
public UniformFloat StartProgress;
public UniformFloat EndProgress;
public UniformVector2 ProgressRange;
public UniformFloat PathRadius;
public UniformFloat Padding;
public UniformFloat GlowPortion;