diff --git a/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs b/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs index aa3b6c1f41..b6e2f494d1 100644 --- a/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs @@ -142,14 +142,17 @@ namespace osu.Game.Screens.Play.HUD Current.BindValueChanged(v => { - if (v.NewValue >= GlowBarValue) - finishMissDisplay(); + Scheduler.AddOnce(() => + { + if (v.NewValue >= GlowBarValue) + finishMissDisplay(); - double time = v.NewValue > GlowBarValue ? 500 : 250; + double time = v.NewValue > GlowBarValue ? 500 : 250; - this.TransformTo(nameof(HealthBarValue), v.NewValue, time, Easing.OutQuint); - if (resetMissBarDelegate == null) - this.TransformTo(nameof(GlowBarValue), v.NewValue, time, Easing.OutQuint); + this.TransformTo(nameof(HealthBarValue), v.NewValue, time, Easing.OutQuint); + if (resetMissBarDelegate == null) + this.TransformTo(nameof(GlowBarValue), v.NewValue, time, Easing.OutQuint); + }); }, true); BarLength.BindValueChanged(l => Width = l.NewValue, true); diff --git a/osu.Game/Screens/Play/HUD/DefaultHealthDisplay.cs b/osu.Game/Screens/Play/HUD/DefaultHealthDisplay.cs index c4d04c5580..0d3bd8d46f 100644 --- a/osu.Game/Screens/Play/HUD/DefaultHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/DefaultHealthDisplay.cs @@ -112,6 +112,13 @@ namespace osu.Game.Screens.Play.HUD }; } + protected override void Flash(JudgementResult result) + { + fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, Easing.OutQuint) + .Delay(glow_fade_delay) + .FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, Easing.OutQuint); + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { @@ -119,15 +126,6 @@ namespace osu.Game.Screens.Play.HUD GlowColour = colours.BlueDarker; } - protected override void Flash(JudgementResult result) => Scheduler.AddOnce(flash); - - private void flash() - { - fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, Easing.OutQuint) - .Delay(glow_fade_delay) - .FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, Easing.OutQuint); - } - protected override void Update() { base.Update(); diff --git a/osu.Game/Screens/Play/HUD/HealthDisplay.cs b/osu.Game/Screens/Play/HUD/HealthDisplay.cs index 986efe3036..e297ffc411 100644 --- a/osu.Game/Screens/Play/HUD/HealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/HealthDisplay.cs @@ -39,6 +39,7 @@ namespace osu.Game.Screens.Play.HUD /// /// Triggered when a is a successful hit, signaling the health display to perform a flash animation (if designed to do so). + /// Calls to this method are debounced. /// /// The judgement result. protected virtual void Flash(JudgementResult result) @@ -47,6 +48,7 @@ namespace osu.Game.Screens.Play.HUD /// /// Triggered when a resulted in the player losing health. + /// Calls to this method are debounced. /// /// The judgement result. protected virtual void Miss(JudgementResult result) @@ -92,7 +94,7 @@ namespace osu.Game.Screens.Play.HUD { double newValue = Current.Value + 0.05f; this.TransformBindableTo(Current, newValue, increase_delay); - Flash(new JudgementResult(new HitObject(), new Judgement())); + Scheduler.AddOnce(Flash, new JudgementResult(new HitObject(), new Judgement())); if (newValue >= 1) finishInitialAnimation(); @@ -115,9 +117,9 @@ namespace osu.Game.Screens.Play.HUD private void onNewJudgement(JudgementResult judgement) { if (judgement.IsHit && judgement.Type != HitResult.IgnoreHit) - Flash(judgement); + Scheduler.AddOnce(Flash, judgement); else if (judgement.Judgement.HealthIncreaseFor(judgement) < 0) - Miss(judgement); + Scheduler.AddOnce(Miss, judgement); } protected override void Dispose(bool isDisposing)