mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Merge branch 'master' into fix-new-inspections
This commit is contained in:
@ -196,9 +196,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public bool PauseOverlayVisible => PauseOverlay.State == Visibility.Visible;
|
public bool PauseOverlayVisible => PauseOverlay.State == Visibility.Visible;
|
||||||
|
|
||||||
public PausePlayer()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
PauseOnFocusLost = false;
|
base.LoadComplete();
|
||||||
|
HUDOverlay.HoldToQuit.PauseOnFocusLost = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -70,6 +71,11 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
return base.OnMouseMove(e);
|
return base.OnMouseMove(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool PauseOnFocusLost
|
||||||
|
{
|
||||||
|
set => button.PauseOnFocusLost = value;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
@ -93,8 +99,10 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
public Action HoverGained;
|
public Action HoverGained;
|
||||||
public Action HoverLost;
|
public Action HoverLost;
|
||||||
|
|
||||||
|
private readonly IBindable<bool> gameActive = new Bindable<bool>(true);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours, Framework.Game game)
|
||||||
{
|
{
|
||||||
Size = new Vector2(60);
|
Size = new Vector2(60);
|
||||||
|
|
||||||
@ -135,6 +143,14 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
};
|
};
|
||||||
|
|
||||||
bind();
|
bind();
|
||||||
|
|
||||||
|
gameActive.BindTo(game.IsActive);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
gameActive.BindValueChanged(_ => updateActive(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bind()
|
private void bind()
|
||||||
@ -184,6 +200,31 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
base.OnHoverLost(e);
|
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) return;
|
||||||
|
|
||||||
|
if (gameActive.Value)
|
||||||
|
AbortConfirm();
|
||||||
|
else
|
||||||
|
BeginConfirm();
|
||||||
|
}
|
||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
public bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
switch (action)
|
switch (action)
|
||||||
|
@ -44,8 +44,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public bool HasFailed { get; private set; }
|
public bool HasFailed { get; private set; }
|
||||||
|
|
||||||
public bool PauseOnFocusLost { get; set; } = true;
|
|
||||||
|
|
||||||
private Bindable<bool> mouseWheelDisabled;
|
private Bindable<bool> mouseWheelDisabled;
|
||||||
|
|
||||||
private readonly Bindable<bool> storyboardReplacesBackground = new Bindable<bool>();
|
private readonly Bindable<bool> storyboardReplacesBackground = new Bindable<bool>();
|
||||||
@ -388,15 +386,6 @@ namespace osu.Game.Screens.Play
|
|||||||
// already resuming
|
// already resuming
|
||||||
&& !IsResuming;
|
&& !IsResuming;
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
// eagerly pause when we lose window focus (if we are locally playing).
|
|
||||||
if (PauseOnFocusLost && !Game.IsActive.Value)
|
|
||||||
Pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Pause()
|
public void Pause()
|
||||||
{
|
{
|
||||||
if (!canPause) return;
|
if (!canPause) return;
|
||||||
|
Reference in New Issue
Block a user