From ffe82aad25659c6f113ac9db685bcca581b815ab Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 10 Jul 2018 21:57:09 +0200 Subject: [PATCH 1/8] Add basic quick exit functionality --- .../Input/Bindings/GlobalActionContainer.cs | 3 ++ osu.Game/Screens/Play/Player.cs | 13 +++++++++ osu.Game/Screens/Play/QuickExit.cs | 28 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 osu.Game/Screens/Play/QuickExit.cs diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index b21deff509..f4419cc6d0 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -49,6 +49,7 @@ namespace osu.Game.Input.Bindings { new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene), new KeyBinding(InputKey.Tilde, GlobalAction.QuickRetry), + new KeyBinding(new[] { InputKey.Alt, InputKey.Tilde }, GlobalAction.QuickExit), new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed), new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed), }; @@ -83,6 +84,8 @@ namespace osu.Game.Input.Bindings SkipCutscene, [Description("Quick Retry (Hold)")] QuickRetry, + [Description("Quick Exit (Hold)")] + QuickExit, [Description("Take screenshot")] TakeScreenshot, diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b406bda411..84fcede6b5 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -71,6 +71,7 @@ namespace osu.Game.Screens.Play private APIAccess api; private SampleChannel sampleRestart; + private SampleChannel sampleExit; protected ScoreProcessor ScoreProcessor; protected RulesetContainer RulesetContainer; @@ -93,6 +94,7 @@ namespace osu.Game.Screens.Play return; sampleRestart = audio.Sample.Get(@"Gameplay/restart"); + sampleExit = audio.Sample.Get(@"UI/screen-back"); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); userAudioOffset = config.GetBindable(OsuSetting.AudioOffset); @@ -224,6 +226,17 @@ namespace osu.Game.Screens.Play RulesetContainer?.Hide(); Restart(); }, + }, + new QuickExit + { + Action = () => + { + if (!IsCurrentScreen) return; + + sampleExit?.Play(); + ValidForResume = false; + Exit(); + } } }; diff --git a/osu.Game/Screens/Play/QuickExit.cs b/osu.Game/Screens/Play/QuickExit.cs new file mode 100644 index 0000000000..611b02c543 --- /dev/null +++ b/osu.Game/Screens/Play/QuickExit.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCEusing System; + +using osu.Framework.Input.Bindings; +using osu.Game.Input.Bindings; +using osu.Game.Overlays; + +namespace osu.Game.Screens.Play +{ + public class QuickExit : HoldToConfirmOverlay, IKeyBindingHandler + { + public bool OnPressed(GlobalAction action) + { + if (action != GlobalAction.QuickExit) return false; + + BeginConfirm(); + return true; + } + + public bool OnReleased(GlobalAction action) + { + if (action != GlobalAction.QuickExit) return false; + + AbortConfirm(); + return true; + } + } +} From 4c6286a3ca1929cbe5c96410ea8121da00f65a40 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 10 Jul 2018 22:16:08 +0200 Subject: [PATCH 2/8] Fix license header --- osu.Game/Screens/Play/QuickExit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/QuickExit.cs b/osu.Game/Screens/Play/QuickExit.cs index 611b02c543..0c3908a44f 100644 --- a/osu.Game/Screens/Play/QuickExit.cs +++ b/osu.Game/Screens/Play/QuickExit.cs @@ -1,5 +1,5 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCEusing System; +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Input.Bindings; using osu.Game.Input.Bindings; From 4cc22387d4a3481972ae35688952a392a1fb79fb Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 11 Jul 2018 12:03:05 +0200 Subject: [PATCH 3/8] Avoid interversion key configuration conflicts --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index f4419cc6d0..56d8db72fe 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -84,8 +84,6 @@ namespace osu.Game.Input.Bindings SkipCutscene, [Description("Quick Retry (Hold)")] QuickRetry, - [Description("Quick Exit (Hold)")] - QuickExit, [Description("Take screenshot")] TakeScreenshot, @@ -103,5 +101,8 @@ namespace osu.Game.Input.Bindings [Description("Select")] Select, + + [Description("Quick Exit (Hold)")] + QuickExit, } } From fde9df39389e88368360ce46ad2e651ac459a778 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 11 Jul 2018 14:47:34 +0200 Subject: [PATCH 4/8] Same as #3006 + hide gameplay instantly --- osu.Game/Screens/Play/Player.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 84fcede6b5..e0d5fed212 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -235,6 +235,8 @@ namespace osu.Game.Screens.Play sampleExit?.Play(); ValidForResume = false; + RulesetContainer?.Hide(); + pauseContainer?.Hide(); Exit(); } } From 07183c0069691ee0c39af25e3535b6362af121bd Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 15 Jul 2018 00:52:15 +0200 Subject: [PATCH 5/8] Hide Content instead of particular overlays --- osu.Game/Screens/Play/Player.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e0d5fed212..c575824c1c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -235,8 +235,7 @@ namespace osu.Game.Screens.Play sampleExit?.Play(); ValidForResume = false; - RulesetContainer?.Hide(); - pauseContainer?.Hide(); + Content.Hide(); Exit(); } } From fad1ced1b57303be23a28ee5e4077100950148fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Jun 2019 18:15:27 +0900 Subject: [PATCH 6/8] Add correct conditionals to allow exit --- osu.Game/Screens/Play/Player.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c3e351a0ca..c3a9ffdaba 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -177,6 +177,16 @@ namespace osu.Game.Screens.Play Restart(); }, }, + new HotkeyExitOverlay + { + Action = () => + { + if (!this.IsCurrentScreen()) return; + + fadeOut(true); + performUserRequestedExit(); + }, + }, failAnimation = new FailAnimation(DrawableRuleset) { OnComplete = onFailComplete, } }; @@ -245,6 +255,11 @@ namespace osu.Game.Screens.Play { if (!this.IsCurrentScreen()) return; + // if a restart has been requested, cancel any pending completion (user has shown intent to restart). + onCompletionEvent = null; + + ValidForResume = false; + this.Exit(); } From 2ea5165803928c0fe4e11f452012cee6fdea7636 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Jun 2019 18:19:17 +0900 Subject: [PATCH 7/8] Change case to match; change hotkey to be more globally usable (previous has conflict on macOS) --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index cb913e386b..904aa9c8c0 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -50,7 +50,7 @@ namespace osu.Game.Input.Bindings { new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene), new KeyBinding(InputKey.Tilde, GlobalAction.QuickRetry), - new KeyBinding(new[] { InputKey.Alt, InputKey.Tilde }, GlobalAction.QuickExit), + new KeyBinding(new[] { InputKey.Control, InputKey.Tilde }, GlobalAction.QuickExit), new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed), new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed), }; @@ -95,6 +95,9 @@ namespace osu.Game.Input.Bindings [Description("Quick retry (hold)")] QuickRetry, + [Description("Quick exit (Hold)")] + QuickExit, + [Description("Take screenshot")] TakeScreenshot, @@ -112,8 +115,5 @@ namespace osu.Game.Input.Bindings [Description("Select")] Select, - - [Description("Quick Exit (Hold)")] - QuickExit, } } From f91467eddc6be5dc731d6236bbb040a4590529ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Jun 2019 18:29:30 +0900 Subject: [PATCH 8/8] Fix licence header --- osu.Game/Screens/Play/HotkeyExitOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HotkeyExitOverlay.cs b/osu.Game/Screens/Play/HotkeyExitOverlay.cs index 391cc2b753..c18aecda55 100644 --- a/osu.Game/Screens/Play/HotkeyExitOverlay.cs +++ b/osu.Game/Screens/Play/HotkeyExitOverlay.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Input.Bindings; using osu.Game.Input.Bindings;