mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
Merge pull request #6175 from peppy/confirm-via-key
Always show exit confirmation when closing via alt-f4 or window control
This commit is contained in:
commit
c09f384a7e
@ -69,11 +69,22 @@ namespace osu.Game.Screens.Menu
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config)
|
private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
if (host.CanExit)
|
|
||||||
AddInternal(exitConfirmOverlay = new ExitConfirmOverlay { Action = this.Exit });
|
|
||||||
|
|
||||||
holdDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay);
|
holdDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay);
|
||||||
|
|
||||||
|
if (host.CanExit)
|
||||||
|
{
|
||||||
|
AddInternal(exitConfirmOverlay = new ExitConfirmOverlay
|
||||||
|
{
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
if (holdDelay.Value > 0)
|
||||||
|
confirmAndExit();
|
||||||
|
else
|
||||||
|
this.Exit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
new ParallaxContainer
|
new ParallaxContainer
|
||||||
@ -241,7 +252,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
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()));
|
dialogOverlay.Push(new ConfirmExitDialog(confirmAndExit, () => exitConfirmOverlay.Abort()));
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user