From 7cbebe6d11f4766420d6d0e48fd63cadec90dd52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Jun 2021 18:10:59 +0900 Subject: [PATCH 1/4] Rewrite xmldoc and inline comments for `PerformExit` --- osu.Game/Screens/Play/Player.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f9036780aa..ae8993cf06 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -512,19 +512,23 @@ namespace osu.Game.Screens.Play } /// - /// Exits the . + /// Attempts to complete a user request to exit gameplay. /// + /// + /// - This should only be called in response to a user interaction. Exiting is not guaranteed. + /// - This will interrupt any pending progression to the results screen, even if the transition has begun. + /// /// /// Whether the pause or fail dialog should be shown before performing an exit. - /// If true and a dialog is not yet displayed, the exit will be blocked the the relevant dialog will display instead. + /// If true and a dialog is not yet displayed, the exit will be blocked the relevant dialog will display instead. /// protected void PerformExit(bool showDialogFirst) { - // if a restart has been requested, cancel any pending completion (user has shown intent to restart). + // if an exit has been requested, cancel any pending completion (the user has showing intention to exit). completionProgressDelegate?.Cancel(); - // there is a chance that the exit was performed after the transition to results has started. - // we want to give the user what they want, so forcefully return to this screen (to proceed with the upwards exit process). + // there is a chance that an exit request occurs after the transition to results has already started. + // even in such a case, the user has shown intent, so forcefully return to this screen (to proceed with the upwards exit process). if (!this.IsCurrentScreen()) { ValidForResume = false; @@ -547,7 +551,7 @@ namespace osu.Game.Screens.Play return; } - // there's a chance the pausing is not supported in the current state, at which point immediate exit should be preferred. + // even if this call has requested a dialog, there is a chance the current player mode doesn't support pausing. if (pausingSupportedByCurrentState) { // in the case a dialog needs to be shown, attempt to pause and show it. @@ -563,6 +567,10 @@ namespace osu.Game.Screens.Play } } + // The actual exit is performed if + // - the pause / fail dialog was not requested + // - the pause / fail dialog was requested but is already displayed (user showing intention to exit). + // - the pause / fail dialog was requested but couldn't be displayed due to the type or state of this Player instance. this.Exit(); } From 246ab41cc68e361ea9ba71430dbfd8b776fcad54 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Jun 2021 18:11:15 +0900 Subject: [PATCH 2/4] Remove special casing for user exit during storyboard outro --- .../Visual/Gameplay/TestSceneStoryboardWithOutro.cs | 4 ++-- osu.Game/Screens/Play/Player.cs | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs index 5ef3eff856..3ed274690e 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboardWithOutro.cs @@ -66,12 +66,12 @@ namespace osu.Game.Tests.Visual.Gameplay } [Test] - public void TestStoryboardExitToSkipOutro() + public void TestStoryboardExitDuringOutroStillExits() { CreateTest(null); AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value); AddStep("exit via pause", () => Player.ExitViaPause()); - AddAssert("score shown", () => Player.IsScoreShown); + AddAssert("player exited", () => !Player.IsCurrentScreen() && Player.GetChildScreen() == null); } [TestCase(false)] diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ae8993cf06..b8d2b42992 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -559,12 +559,6 @@ namespace osu.Game.Screens.Play Pause(); return; } - - // if the score is ready for display but results screen has not been pushed yet (e.g. storyboard is still playing beyond gameplay), then transition to results screen instead of exiting. - if (prepareScoreForDisplayTask != null && completionProgressDelegate == null) - { - updateCompletionState(true); - } } // The actual exit is performed if From 561dbea9e1c2ff77df25eee5499b62684b4ffa65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 17 Jun 2021 15:26:50 +0200 Subject: [PATCH 3/4] Use xmldoc-specific syntax for nicer formatting --- osu.Game/Screens/Play/Player.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b8d2b42992..df3348c9d5 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -515,12 +515,14 @@ namespace osu.Game.Screens.Play /// Attempts to complete a user request to exit gameplay. /// /// - /// - This should only be called in response to a user interaction. Exiting is not guaranteed. - /// - This will interrupt any pending progression to the results screen, even if the transition has begun. + /// + /// This should only be called in response to a user interaction. Exiting is not guaranteed. + /// This will interrupt any pending progression to the results screen, even if the transition has begun. + /// /// /// /// Whether the pause or fail dialog should be shown before performing an exit. - /// If true and a dialog is not yet displayed, the exit will be blocked the relevant dialog will display instead. + /// If and a dialog is not yet displayed, the exit will be blocked the relevant dialog will display instead. /// protected void PerformExit(bool showDialogFirst) { From 10b0d066beb7e9e6fae56f10c7253739c6cecc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 17 Jun 2021 16:04:58 +0200 Subject: [PATCH 4/4] Reword comments slightly --- osu.Game/Screens/Play/Player.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index df3348c9d5..5ffe2bac49 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -522,11 +522,11 @@ namespace osu.Game.Screens.Play /// /// /// Whether the pause or fail dialog should be shown before performing an exit. - /// If and a dialog is not yet displayed, the exit will be blocked the relevant dialog will display instead. + /// If and a dialog is not yet displayed, the exit will be blocked and the relevant dialog will display instead. /// protected void PerformExit(bool showDialogFirst) { - // if an exit has been requested, cancel any pending completion (the user has showing intention to exit). + // if an exit has been requested, cancel any pending completion (the user has shown intention to exit). completionProgressDelegate?.Cancel(); // there is a chance that an exit request occurs after the transition to results has already started.