1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:53:51 +08:00

Fix player not correctly exiting after an unpause

This commit is contained in:
smoogipoo 2019-09-13 15:41:53 +09:00
parent fd758c77d2
commit cf2f841b4d
2 changed files with 21 additions and 8 deletions

View File

@ -160,6 +160,15 @@ namespace osu.Game.Tests.Visual.Gameplay
exitAndConfirm(); exitAndConfirm();
} }
[Test]
public void TestRestartAfterResume()
{
pauseAndConfirm();
resumeAndConfirm();
restart();
confirmExited();
}
private void pauseAndConfirm() private void pauseAndConfirm()
{ {
pause(); pause();
@ -198,6 +207,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("player exited", () => !Player.IsCurrentScreen()); AddUntilStep("player exited", () => !Player.IsCurrentScreen());
} }
private void restart() => AddStep("restart", () => Player.Restart());
private void pause() => AddStep("pause", () => Player.Pause()); private void pause() => AddStep("pause", () => Player.Pause());
private void resume() => AddStep("resume", () => Player.Resume()); private void resume() => AddStep("resume", () => Player.Resume());

View File

@ -502,15 +502,18 @@ namespace osu.Game.Screens.Play
return true; return true;
} }
if (pauseCooldownActive && !GameplayClockContainer.IsPaused.Value) // ValidForResume is false when restarting
// still want to block if we are within the cooldown period and not already paused. if (ValidForResume)
return true;
if (HasFailed && ValidForResume && !FailOverlay.IsPresent)
// ValidForResume is false when restarting
{ {
failAnimation.FinishTransforms(true); if (pauseCooldownActive && !GameplayClockContainer.IsPaused.Value)
return true; // still want to block if we are within the cooldown period and not already paused.
return true;
if (HasFailed && !FailOverlay.IsPresent)
{
failAnimation.FinishTransforms(true);
return true;
}
} }
GameplayClockContainer.ResetLocalAdjustments(); GameplayClockContainer.ResetLocalAdjustments();