1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 13:42:59 +08:00

Fix instant pausing when game becomes inactive

Resolves #4685.
This commit is contained in:
Dean Herbert 2019-04-30 21:52:49 +09:00
parent f05471aa18
commit b9a39fb788
2 changed files with 26 additions and 2 deletions

View File

@ -70,6 +70,11 @@ namespace osu.Game.Screens.Play.HUD
return base.OnMouseMove(e);
}
public bool GameInactive
{
set => button.GameInactive = value;
}
protected override void Update()
{
base.Update();
@ -184,6 +189,25 @@ namespace osu.Game.Screens.Play.HUD
base.OnHoverLost(e);
}
private bool gameInactive;
public bool GameInactive
{
get => gameInactive;
set
{
if (gameInactive == value)
return;
gameInactive = value;
if (gameInactive)
BeginConfirm();
else
AbortConfirm();
}
}
public bool OnPressed(GlobalAction action)
{
switch (action)

View File

@ -393,8 +393,8 @@ namespace osu.Game.Screens.Play
base.Update();
// eagerly pause when we lose window focus (if we are locally playing).
if (PauseOnFocusLost && !Game.IsActive.Value)
Pause();
if (PauseOnFocusLost)
HUDOverlay.HoldToQuit.GameInactive = !Game.IsActive.Value;
}
public void Pause()