From ce0d4bd0df26839eab2dec51f9312f5a614eb008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 Oct 2023 21:30:41 +0200 Subject: [PATCH] Fix health display potentially desyncing from actual if health was changed during initial animation --- osu.Game/Screens/Play/HUD/HealthDisplay.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/HealthDisplay.cs b/osu.Game/Screens/Play/HUD/HealthDisplay.cs index 24af3051e374..2ec63feeae80 100644 --- a/osu.Game/Screens/Play/HUD/HealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/HealthDisplay.cs @@ -66,8 +66,8 @@ protected override void LoadComplete() health = HealthProcessor.Health.GetBoundCopy(); health.BindValueChanged(h => { - Current.Value = h.NewValue; finishInitialAnimation(); + Current.Value = h.NewValue; }); if (hudOverlay != null) @@ -103,6 +103,11 @@ private void finishInitialAnimation() { initialIncrease?.Cancel(); initialIncrease = null; + + // aside from the repeating `initialIncrease` scheduled task, + // there may also be a `Current` transform in progress from that schedule. + // ensure it plays out fully, to prevent changes to `Current.Value` being discarded by the ongoing transform. + FinishTransforms(); } private void onNewJudgement(JudgementResult judgement)