From df51d345c5e1e49b98c43b898f38ccd0403b5abf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Feb 2025 17:36:47 +0900 Subject: [PATCH] Change menus to fade out with a slight delay so settings changes are visible Useful for cases like https://github.com/ppy/osu/pull/31778, where a change to one setting can affect another. --- osu.Game/Graphics/UserInterface/OsuMenu.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 7cc1bab25f..9b099c0884 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -68,7 +68,9 @@ namespace osu.Game.Graphics.UserInterface if (!TopLevelMenu && wasOpened) menuSamples?.PlayCloseSample(); - this.FadeOut(300, Easing.OutQuint); + this.Delay(50) + .FadeOut(300, Easing.OutQuint); + wasOpened = false; } @@ -77,12 +79,21 @@ namespace osu.Game.Graphics.UserInterface if (Direction == Direction.Vertical) { Width = newSize.X; - this.ResizeHeightTo(newSize.Y, 300, Easing.OutQuint); + + if (newSize.Y > 0) + this.ResizeHeightTo(newSize.Y, 300, Easing.OutQuint); + else + // Delay until the fade out finishes from AnimateClose. + this.Delay(350).ResizeHeightTo(0); } else { Height = newSize.Y; - this.ResizeWidthTo(newSize.X, 300, Easing.OutQuint); + if (newSize.X > 0) + this.ResizeWidthTo(newSize.X, 300, Easing.OutQuint); + else + // Delay until the fade out finishes from AnimateClose. + this.Delay(350).ResizeWidthTo(0); } }