1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 11:47:24 +08:00

Adjust transition further to avoid brief "jumpscare" display of metadata

This commit is contained in:
Dean Herbert 2024-11-14 18:27:26 +09:00
parent f597568476
commit 9849a88eef
No known key found for this signature in database

View File

@ -10,6 +10,7 @@ using osu.Framework.Audio;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.Transforms;
using osu.Framework.Input; using osu.Framework.Input;
@ -88,9 +89,13 @@ namespace osu.Game.Screens.Play
private SkinnableSound sampleRestart = null!; private SkinnableSound sampleRestart = null!;
private Box? quickRestartBlackLayer;
[Cached] [Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
private const double quick_restart_initial_delay = 500;
protected bool BackgroundBrightnessReduction protected bool BackgroundBrightnessReduction
{ {
set set
@ -307,6 +312,9 @@ namespace osu.Game.Screens.Play
{ {
base.OnSuspending(e); base.OnSuspending(e);
quickRestartBlackLayer?.FadeOut(500, Easing.OutQuint);
quickRestartBlackLayer = null;
BackgroundBrightnessReduction = false; BackgroundBrightnessReduction = false;
// we're moving to player, so a period of silence is upcoming. // we're moving to player, so a period of silence is upcoming.
@ -350,6 +358,13 @@ namespace osu.Game.Screens.Play
if (!resuming) logo.MoveTo(new Vector2(0.5f), duration, Easing.OutQuint); if (!resuming) logo.MoveTo(new Vector2(0.5f), duration, Easing.OutQuint);
logo.ScaleTo(new Vector2(0.15f), duration, Easing.OutQuint); logo.ScaleTo(new Vector2(0.15f), duration, Easing.OutQuint);
if (quickRestart)
{
logo.Delay(quick_restart_initial_delay)
.FadeIn(350);
}
else
logo.FadeIn(350); logo.FadeIn(350);
Scheduler.AddDelayed(() => Scheduler.AddDelayed(() =>
@ -456,17 +471,33 @@ namespace osu.Game.Screens.Play
{ {
MetadataInfo.Loading = true; MetadataInfo.Loading = true;
content.FadeInFromZero(500, Easing.OutQuint);
if (quickRestart) if (quickRestart)
{ {
// A slight delay is added here to avoid an awkward stutter during the initial animation. // A quick restart starts by triggering a fade to black
Scheduler.AddDelayed(prepareNewPlayer, 100); AddInternal(quickRestartBlackLayer = new Box
content.ScaleTo(1); {
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
Depth = float.MaxValue
});
quickRestartBlackLayer
.Delay(50)
.FadeOut(5000, Easing.OutQuint);
prepareNewPlayer();
content
.Delay(quick_restart_initial_delay)
.ScaleTo(1)
.FadeInFromZero(500, Easing.OutQuint);
} }
else else
{ {
content.FadeInFromZero(500, Easing.OutQuint);
content content
.ScaleTo(0.7f)
.ScaleTo(1, 650, Easing.OutQuint) .ScaleTo(1, 650, Easing.OutQuint)
.Then() .Then()
.Schedule(prepareNewPlayer); .Schedule(prepareNewPlayer);
@ -568,7 +599,10 @@ namespace osu.Game.Screens.Play
else else
this.Exit(); this.Exit();
}); });
}, quickRestart ? 0 : 500); },
// When a quick restart is activated, the metadata content will display some time later if it's taking too long.
// To avoid it appearing too briefly, if it begins to fade in let's induce a standard delay.
quickRestart && content.Alpha == 0 ? 0 : 500);
} }
private void cancelLoad() private void cancelLoad()