From 0e0d96829f45c65eb0befea8e7a35b7e0208f68a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Dec 2024 18:08:29 +0900 Subject: [PATCH 1/3] Fix "quick retry" hotkey not working for autoplay --- osu.Game/Screens/Play/ReplayPlayer.cs | 11 +++++++++-- osu.Game/Screens/Ranking/RetryButton.cs | 9 +++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/ReplayPlayer.cs b/osu.Game/Screens/Play/ReplayPlayer.cs index 0c125264a1..c1b5397e61 100644 --- a/osu.Game/Screens/Play/ReplayPlayer.cs +++ b/osu.Game/Screens/Play/ReplayPlayer.cs @@ -34,10 +34,12 @@ namespace osu.Game.Screens.Play protected override UserActivity InitialActivity => new UserActivity.WatchingReplay(Score.ScoreInfo); + private bool isAutoplayPlayback => GameplayState.Mods.OfType().Any(); + // Disallow replays from failing. (see https://github.com/ppy/osu/issues/6108) protected override bool CheckModsAllowFailure() { - if (!replayIsFailedScore && !GameplayState.Mods.OfType().Any()) + if (!replayIsFailedScore && !isAutoplayPlayback) return false; return base.CheckModsAllowFailure(); @@ -102,7 +104,12 @@ namespace osu.Game.Screens.Play Scores = { BindTarget = LeaderboardScores } }; - protected override ResultsScreen CreateResults(ScoreInfo score) => new SoloResultsScreen(score); + protected override ResultsScreen CreateResults(ScoreInfo score) => new SoloResultsScreen(score) + { + // Only show the relevant button otherwise things look silly. + AllowWatchingReplay = !isAutoplayPlayback, + AllowRetry = isAutoplayPlayback, + }; public bool OnPressed(KeyBindingPressEvent e) { diff --git a/osu.Game/Screens/Ranking/RetryButton.cs b/osu.Game/Screens/Ranking/RetryButton.cs index d977f25323..8b4f3ca14c 100644 --- a/osu.Game/Screens/Ranking/RetryButton.cs +++ b/osu.Game/Screens/Ranking/RetryButton.cs @@ -38,8 +38,6 @@ namespace osu.Game.Screens.Ranking Icon = FontAwesome.Solid.Redo, }, }; - - TooltipText = "retry"; } [BackgroundDependencyLoader] @@ -48,7 +46,14 @@ namespace osu.Game.Screens.Ranking background.Colour = colours.Green; if (player != null) + { + TooltipText = player is ReplayPlayer ? "replay" : "retry"; Action = () => player.Restart(); + } + else + { + TooltipText = "retry"; + } } } } From d00bc4bdd1e97a1400de9ca95a6b1167334cf16a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Dec 2024 18:14:45 +0900 Subject: [PATCH 2/3] Also allow using "quick retry" for other replays --- osu.Game/Screens/Ranking/ResultsScreen.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 507d138d90..e3284aac70 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -84,6 +84,7 @@ namespace osu.Game.Screens.Ranking /// public bool ShowUserStatistics { get; init; } + // Only show the relevant button otherwise things look silly. private Sample? popInSample; protected ResultsScreen(ScoreInfo? score) @@ -186,6 +187,8 @@ namespace osu.Game.Screens.Ranking Scheduler.AddDelayed(() => OverlayActivationMode.Value = OverlayActivation.All, shouldFlair ? AccuracyCircle.TOTAL_DURATION + 1000 : 0); } + bool allowHotkeyRetry = false; + if (AllowWatchingReplay) { buttons.Add(new ReplayDownloadButton(SelectedScore.Value) @@ -193,12 +196,19 @@ namespace osu.Game.Screens.Ranking Score = { BindTarget = SelectedScore }, Width = 300 }); + + // for simplicity, only allow when we're guaranteed the replay is already downloaded and present. + allowHotkeyRetry = player is ReplayPlayer; } if (player != null && AllowRetry) { buttons.Add(new RetryButton { Width = 300 }); + allowHotkeyRetry = true; + } + if (allowHotkeyRetry) + { AddInternal(new HotkeyRetryOverlay { Action = () => From 9025103b8bb9bcb2dbb4e5fcca80c0ec96b84e96 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Dec 2024 20:02:17 +0900 Subject: [PATCH 3/3] Reword comment to hopefully be more understandable --- osu.Game/Screens/Ranking/ResultsScreen.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index e3284aac70..5e91171051 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -84,7 +84,6 @@ namespace osu.Game.Screens.Ranking /// public bool ShowUserStatistics { get; init; } - // Only show the relevant button otherwise things look silly. private Sample? popInSample; protected ResultsScreen(ScoreInfo? score) @@ -197,7 +196,10 @@ namespace osu.Game.Screens.Ranking Width = 300 }); - // for simplicity, only allow when we're guaranteed the replay is already downloaded and present. + // for simplicity, only allow this when coming from a replay player where we know the replay is ready to be played. + // + // if we show it in all cases, consider the case where a user comes from song select and potentially has to download + // the replay before it can be played back. it wouldn't flow well with the quick retry in such a case. allowHotkeyRetry = player is ReplayPlayer; }