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

Refactor again to better cover cases where the pause dialog should definitely be shown

This commit is contained in:
Dean Herbert 2021-02-15 15:57:21 +09:00
parent 4f264758a4
commit 9cba350337

View File

@ -487,35 +487,30 @@ namespace osu.Game.Screens.Play
// if a restart has been requested, cancel any pending completion (user has shown intent to restart). // if a restart has been requested, cancel any pending completion (user has shown intent to restart).
completionProgressDelegate?.Cancel(); 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).
if (!this.IsCurrentScreen()) if (!this.IsCurrentScreen())
{ {
// 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).
ValidForResume = false; ValidForResume = false;
this.MakeCurrent(); this.MakeCurrent();
return; return;
} }
if (showDialogFirst) bool pauseDialogShown = PauseOverlay.State.Value == Visibility.Visible;
if (showDialogFirst && !pauseDialogShown)
{ {
// if the fail animation is currently in progress, accelerate it (it will show the pause dialog on completion).
if (ValidForResume && HasFailed && !FailOverlay.IsPresent) if (ValidForResume && HasFailed && !FailOverlay.IsPresent)
{ {
failAnimation.FinishTransforms(true); failAnimation.FinishTransforms(true);
return; return;
} }
if (!GameplayClockContainer.IsPaused.Value) // in the case a dialog needs to be shown, attempt to pause and show it.
{ // this may fail (see internal checks in Pause()) at which point the exit attempt will be aborted.
// if we are within the cooldown period and not already paused, the operation should block completely. Pause();
if (pauseCooldownActive) return;
return;
if (canPause)
{
Pause();
return;
}
}
} }
this.Exit(); this.Exit();