mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Make pausing on window focus lose instant
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user