mirror of
https://github.com/ppy/osu
synced 2024-12-15 19:36:34 +00:00
Fixed a bug where the user can double press escape to exit the song
This commit is contained in:
parent
bcd41a2c8f
commit
13da75f149
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user