1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 03:13:22 +08:00

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?).
This commit is contained in:
Dean Herbert 2024-11-14 15:30:34 +09:00
parent 5cc1cbe880
commit 8f7d2752c0
No known key found for this signature in database
2 changed files with 25 additions and 0 deletions

View File

@ -83,6 +83,11 @@ namespace osu.Game.Screens.Play
/// </summary>
protected virtual bool PauseOnFocusLost => true;
/// <summary>
/// Whether to show the fail overlay (with buttons to retry / exit) on failing.
/// </summary>
protected virtual bool ShowFailOverlay => true;
public Action<bool> RestartRequested;
private bool isRestarting;
@ -990,6 +995,9 @@ namespace osu.Game.Screens.Play
/// </summary>
private void onFailComplete()
{
if (!ShowFailOverlay)
return;
GameplayClockContainer.Stop();
FailOverlay.Retries = RestartCount;

View File

@ -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<GlobalAction> e)
{
}