From 8f7d2752c040c03e1acd4e6fe6de4108079d4981 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Nov 2024 15:30:34 +0900 Subject: [PATCH] Show results screen when reaching the end of a failed replay Addresses https://github.com/ppy/osu/discussions/30577. Consider this a RFC. There's multiple ways this could be implemented, but I went for the most stand-alone approach, bypassing all the score preparation and progress logic (because it's probably simplest this way?). --- osu.Game/Screens/Play/Player.cs | 8 ++++++++ osu.Game/Screens/Play/ReplayPlayer.cs | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 398e8df5c9..36612ed0b5 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -83,6 +83,11 @@ namespace osu.Game.Screens.Play /// protected virtual bool PauseOnFocusLost => true; + /// + /// Whether to show the fail overlay (with buttons to retry / exit) on failing. + /// + protected virtual bool ShowFailOverlay => true; + public Action RestartRequested; private bool isRestarting; @@ -990,6 +995,9 @@ namespace osu.Game.Screens.Play /// private void onFailComplete() { + if (!ShowFailOverlay) + return; + GameplayClockContainer.Stop(); FailOverlay.Retries = RestartCount; diff --git a/osu.Game/Screens/Play/ReplayPlayer.cs b/osu.Game/Screens/Play/ReplayPlayer.cs index 0c125264a1..5bd775749e 100644 --- a/osu.Game/Screens/Play/ReplayPlayer.cs +++ b/osu.Game/Screens/Play/ReplayPlayer.cs @@ -11,6 +11,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Input.Bindings; @@ -34,6 +35,8 @@ namespace osu.Game.Screens.Play protected override UserActivity InitialActivity => new UserActivity.WatchingReplay(Score.ScoreInfo); + protected override bool ShowFailOverlay => false; + // Disallow replays from failing. (see https://github.com/ppy/osu/issues/6108) protected override bool CheckModsAllowFailure() { @@ -157,6 +160,20 @@ namespace osu.Game.Screens.Play Seek(target); } + protected override void OnFail() + { + // Replays will always show the results screen on failing. + Scheduler.AddDelayed(() => + { + if (!this.IsCurrentScreen()) + // This player instance may already be in the process of exiting. + return; + + ValidForResume = false; + this.Push(CreateResults(Score.ScoreInfo)); + }, RESULTS_DISPLAY_DELAY); + } + public void OnReleased(KeyBindingReleaseEvent e) { }