Merge branch 'master' into timing-current-point-indicator

This commit is contained in:
Bartłomiej Dach 2024-12-16 12:22:14 +09:00
commit 98e8d0b497
No known key found for this signature in database
3 changed files with 28 additions and 4 deletions

View File

@ -34,10 +34,12 @@ namespace osu.Game.Screens.Play
protected override UserActivity InitialActivity => new UserActivity.WatchingReplay(Score.ScoreInfo); protected override UserActivity InitialActivity => new UserActivity.WatchingReplay(Score.ScoreInfo);
private bool isAutoplayPlayback => GameplayState.Mods.OfType<ModAutoplay>().Any();
// Disallow replays from failing. (see https://github.com/ppy/osu/issues/6108) // Disallow replays from failing. (see https://github.com/ppy/osu/issues/6108)
protected override bool CheckModsAllowFailure() protected override bool CheckModsAllowFailure()
{ {
if (!replayIsFailedScore && !GameplayState.Mods.OfType<ModAutoplay>().Any()) if (!replayIsFailedScore && !isAutoplayPlayback)
return false; return false;
return base.CheckModsAllowFailure(); return base.CheckModsAllowFailure();
@ -102,7 +104,12 @@ namespace osu.Game.Screens.Play
Scores = { BindTarget = LeaderboardScores } 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<GlobalAction> e) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {

View File

@ -186,6 +186,8 @@ namespace osu.Game.Screens.Ranking
Scheduler.AddDelayed(() => OverlayActivationMode.Value = OverlayActivation.All, shouldFlair ? AccuracyCircle.TOTAL_DURATION + 1000 : 0); Scheduler.AddDelayed(() => OverlayActivationMode.Value = OverlayActivation.All, shouldFlair ? AccuracyCircle.TOTAL_DURATION + 1000 : 0);
} }
bool allowHotkeyRetry = false;
if (AllowWatchingReplay) if (AllowWatchingReplay)
{ {
buttons.Add(new ReplayDownloadButton(SelectedScore.Value) buttons.Add(new ReplayDownloadButton(SelectedScore.Value)
@ -193,12 +195,22 @@ namespace osu.Game.Screens.Ranking
Score = { BindTarget = SelectedScore }, Score = { BindTarget = SelectedScore },
Width = 300 Width = 300
}); });
// 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;
} }
if (player != null && AllowRetry) if (player != null && AllowRetry)
{ {
buttons.Add(new RetryButton { Width = 300 }); buttons.Add(new RetryButton { Width = 300 });
allowHotkeyRetry = true;
}
if (allowHotkeyRetry)
{
AddInternal(new HotkeyRetryOverlay AddInternal(new HotkeyRetryOverlay
{ {
Action = () => Action = () =>

View File

@ -38,8 +38,6 @@ namespace osu.Game.Screens.Ranking
Icon = FontAwesome.Solid.Redo, Icon = FontAwesome.Solid.Redo,
}, },
}; };
TooltipText = "retry";
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -48,7 +46,14 @@ namespace osu.Game.Screens.Ranking
background.Colour = colours.Green; background.Colour = colours.Green;
if (player != null) if (player != null)
{
TooltipText = player is ReplayPlayer ? "replay" : "retry";
Action = () => player.Restart(); Action = () => player.Restart();
}
else
{
TooltipText = "retry";
}
} }
} }
} }