1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-12 21:02:59 +08:00

Use same delay in context menus

This commit is contained in:
Dean Herbert 2025-02-04 23:21:41 +09:00
parent df51d345c5
commit 099ce39531
No known key found for this signature in database
2 changed files with 8 additions and 6 deletions

View File

@ -12,8 +12,6 @@ namespace osu.Game.Graphics.UserInterface
{
public partial class OsuContextMenu : OsuMenu
{
private const int fade_duration = 250;
[Resolved]
private OsuMenuSamples menuSamples { get; set; } = null!;
@ -48,7 +46,7 @@ namespace osu.Game.Graphics.UserInterface
protected override void AnimateOpen()
{
wasOpened = true;
this.FadeIn(fade_duration, Easing.OutQuint);
this.FadeIn(FADE_DURATION, Easing.OutQuint);
if (!playClickSample)
return;
@ -59,7 +57,8 @@ namespace osu.Game.Graphics.UserInterface
protected override void AnimateClose()
{
this.FadeOut(fade_duration, Easing.OutQuint);
this.Delay(DELAY_BEFORE_FADE_OUT)
.FadeOut(FADE_DURATION, Easing.OutQuint);
if (wasOpened)
menuSamples.PlayCloseSample();

View File

@ -18,6 +18,9 @@ namespace osu.Game.Graphics.UserInterface
{
public partial class OsuMenu : Menu
{
protected const double DELAY_BEFORE_FADE_OUT = 50;
protected const double FADE_DURATION = 280;
// todo: this shouldn't be required after https://github.com/ppy/osu-framework/issues/4519 is fixed.
private bool wasOpened;
@ -68,8 +71,8 @@ namespace osu.Game.Graphics.UserInterface
if (!TopLevelMenu && wasOpened)
menuSamples?.PlayCloseSample();
this.Delay(50)
.FadeOut(300, Easing.OutQuint);
this.Delay(DELAY_BEFORE_FADE_OUT)
.FadeOut(FADE_DURATION, Easing.OutQuint);
wasOpened = false;
}