From 636582e089c12f3eb9b814e84c7f3b54cd370e0d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 Sep 2019 02:22:49 +0900 Subject: [PATCH] Always show exit confirmation when closing via alt-f4 or window control --- osu.Game/Screens/Menu/MainMenu.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 0274973161..dd81569e26 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -69,11 +69,22 @@ public class MainMenu : OsuScreen [BackgroundDependencyLoader(true)] private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config) { - if (host.CanExit) - AddInternal(exitConfirmOverlay = new ExitConfirmOverlay { Action = this.Exit }); - holdDelay = config.GetBindable(OsuSetting.UIHoldActivationDelay); + if (host.CanExit) + { + AddInternal(exitConfirmOverlay = new ExitConfirmOverlay + { + Action = () => + { + if (holdDelay.Value > 0) + confirmAndExit(); + else + this.Exit(); + } + }); + } + AddRangeInternal(new Drawable[] { new ParallaxContainer @@ -241,7 +252,7 @@ public override void OnResuming(IScreen last) public override bool OnExiting(IScreen next) { - if (holdDelay.Value == 0 && !exitConfirmed && dialogOverlay != null && !(dialogOverlay.CurrentDialog is ConfirmExitDialog)) + if (!exitConfirmed && dialogOverlay != null && !(dialogOverlay.CurrentDialog is ConfirmExitDialog)) { dialogOverlay.Push(new ConfirmExitDialog(confirmAndExit, () => exitConfirmOverlay.Abort())); return true;