From 13da75f149c65e4d350b643e5709d8b02ea7a7fb Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 31 Jan 2017 20:44:59 -0400 Subject: [PATCH] Fixed a bug where the user can double press escape to exit the song --- osu.Game/Screens/Play/Player.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2cd0995c16..570524187a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -55,6 +55,14 @@ namespace osu.Game.Screens.Play private double pauseCooldown = 1000; private double lastPauseActionTime = 0; + private bool canPause + { + get + { + return Time.Current >= (lastPauseActionTime + pauseCooldown); + } + } + private IAdjustableClock sourceClock; private Ruleset ruleset; @@ -155,7 +163,7 @@ namespace osu.Game.Screens.Play public void Pause(bool force = false) { - if (Time.Current >= (lastPauseActionTime + pauseCooldown) || force) + if (canPause || force) { lastPauseActionTime = Time.Current; playerInputManager.PassThrough = true; @@ -259,6 +267,8 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(GameMode next) { + if (!canPause) return true; + if (!IsPaused && sourceClock.IsRunning) // For if the user presses escape quickly when entering the map { Pause();