1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 23:57:25 +08:00

Make player block exit if pausable (#6992)

Make player block exit if pausable

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2019-12-05 01:39:52 +09:00 committed by GitHub
commit 5c1305a3e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -113,11 +113,11 @@ namespace osu.Game.Tests.Visual.Gameplay
} }
[Test] [Test]
[Ignore("Will be resolved with merge of https://github.com/ppy/osu/pull/6992")]
public void TestExitTooSoon() public void TestExitTooSoon()
{ {
pauseAndConfirm(); AddStep("seek before gameplay", () => Player.GameplayClockContainer.Seek(-5000));
pauseAndConfirm();
resume(); resume();
AddStep("exit too soon", () => Player.Exit()); AddStep("exit too soon", () => Player.Exit());
@ -177,7 +177,9 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestExitFromGameplay() public void TestExitFromGameplay()
{ {
AddStep("exit", () => Player.Exit()); AddStep("exit", () => Player.Exit());
confirmPaused();
AddStep("exit", () => Player.Exit());
confirmExited(); confirmExited();
} }
@ -213,9 +215,10 @@ namespace osu.Game.Tests.Visual.Gameplay
} }
[Test] [Test]
[Ignore("Will be resolved with merge of https://github.com/ppy/osu/pull/6992")]
public void TestRestartAfterResume() public void TestRestartAfterResume()
{ {
AddStep("seek before gameplay", () => Player.GameplayClockContainer.Seek(-5000));
pauseAndConfirm(); pauseAndConfirm();
resumeAndConfirm(); resumeAndConfirm();
restart(); restart();

View File

@ -536,6 +536,12 @@ namespace osu.Game.Screens.Play
return true; return true;
} }
if (canPause)
{
Pause();
return true;
}
// GameplayClockContainer performs seeks / start / stop operations on the beatmap's track. // GameplayClockContainer performs seeks / start / stop operations on the beatmap's track.
// as we are no longer the current screen, we cannot guarantee the track is still usable. // as we are no longer the current screen, we cannot guarantee the track is still usable.
GameplayClockContainer.StopUsingBeatmapClock(); GameplayClockContainer.StopUsingBeatmapClock();