Make pausing on window focus lose instant

This commit is contained in:
Salman Ahmed
2021-02-05 09:07:59 +03:00
parent 8a176e32d6
commit 730e66f0ee
2 changed files with 16 additions and 45 deletions

View File

@ -88,11 +88,6 @@ namespace osu.Game.Screens.Play.HUD
return base.OnMouseMove(e);
}
public bool PauseOnFocusLost
{
set => button.PauseOnFocusLost = value;
}
protected override void Update()
{
base.Update();
@ -120,8 +115,6 @@ namespace osu.Game.Screens.Play.HUD
public Action HoverGained;
public Action HoverLost;
private readonly IBindable<bool> gameActive = new Bindable<bool>(true);
[BackgroundDependencyLoader]
private void load(OsuColour colours, Framework.Game game)
{
@ -164,14 +157,6 @@ namespace osu.Game.Screens.Play.HUD
};
bind();
gameActive.BindTo(game.IsActive);
}
protected override void LoadComplete()
{
base.LoadComplete();
gameActive.BindValueChanged(_ => updateActive(), true);
}
private void bind()
@ -221,31 +206,6 @@ namespace osu.Game.Screens.Play.HUD
base.OnHoverLost(e);
}
private bool pauseOnFocusLost = true;
public bool PauseOnFocusLost
{
set
{
if (pauseOnFocusLost == value)
return;
pauseOnFocusLost = value;
if (IsLoaded)
updateActive();
}
}
private void updateActive()
{
if (!pauseOnFocusLost || IsPaused.Value) return;
if (gameActive.Value)
AbortConfirm();
else
BeginConfirm();
}
public bool OnPressed(GlobalAction action)
{
switch (action)