1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 23:03:02 +08:00

Fix Scheduler.AddOnce not working in one location

This commit is contained in:
Dean Herbert 2023-10-10 16:17:34 +09:00
parent 7e68b64526
commit 4674f63655
No known key found for this signature in database

View File

@ -142,18 +142,8 @@ namespace osu.Game.Screens.Play.HUD
Current.BindValueChanged(v =>
{
Scheduler.AddOnce(() =>
{
if (v.NewValue >= GlowBarValue)
finishMissDisplay();
double time = v.NewValue > GlowBarValue ? 500 : 250;
// TODO: this should probably use interpolation in update.
this.TransformTo(nameof(HealthBarValue), v.NewValue, time, Easing.OutQuint);
if (resetMissBarDelegate == null)
this.TransformTo(nameof(GlowBarValue), v.NewValue, time, Easing.OutQuint);
});
// For some reason making the delegate inline here doesn't work correctly.
Scheduler.AddOnce(updateCurrent);
}, true);
BarLength.BindValueChanged(l => Width = l.NewValue, true);
@ -169,6 +159,17 @@ namespace osu.Game.Screens.Play.HUD
return base.OnInvalidate(invalidation, source);
}
private void updateCurrent()
{
if (Current.Value >= GlowBarValue) finishMissDisplay();
double time = Current.Value > GlowBarValue ? 500 : 250;
// TODO: this should probably use interpolation in update.
this.TransformTo(nameof(HealthBarValue), Current.Value, time, Easing.OutQuint);
if (resetMissBarDelegate == null) this.TransformTo(nameof(GlowBarValue), Current.Value, time, Easing.OutQuint);
}
protected override void Update()
{
base.Update();