mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:07:25 +08:00
Merge pull request #8007 from peppy/fix-hidden-ui-performance
Fix stutter when showing game HUD after being hidden for a while
This commit is contained in:
commit
f1c97451d9
@ -13,12 +13,5 @@ namespace osu.Game.Screens.Play.HUD
|
||||
MinValue = 0,
|
||||
MaxValue = 1
|
||||
};
|
||||
|
||||
protected HealthDisplay()
|
||||
{
|
||||
Current.ValueChanged += health => SetHealth((float)health.NewValue);
|
||||
}
|
||||
|
||||
protected abstract void SetHealth(float value);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ using osu.Game.Rulesets.Judgements;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
@ -108,11 +109,23 @@ namespace osu.Game.Screens.Play.HUD
|
||||
if (result.Type == HitResult.Miss)
|
||||
return;
|
||||
|
||||
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 SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, Easing.OutQuint);
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
fill.Width = Interpolation.ValueAt(
|
||||
Math.Clamp(Clock.ElapsedFrameTime, 0, 200),
|
||||
fill.Width, (float)Current.Value, 0, 200, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user