1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 13:33:52 +08:00

Update in-line with framework IsActive changes

This commit is contained in:
smoogipoo 2019-02-19 19:16:03 +09:00
parent 2bf5534bf1
commit 703df77000
2 changed files with 8 additions and 10 deletions

View File

@ -120,6 +120,8 @@ namespace osu.Game
forwardLoggedErrorsToNotifications();
RavenLogger = new RavenLogger(this);
IsActive.BindValueChanged(updateActiveState);
}
public void ToggleSettings() => settings.ToggleVisibility();
@ -674,16 +676,12 @@ namespace osu.Game
private readonly BindableDouble inactiveVolumeAdjust = new BindableDouble();
protected override void OnDeactivated()
private void updateActiveState(bool isActive)
{
base.OnDeactivated();
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust);
}
protected override void OnActivated()
{
base.OnActivated();
Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust);
if (isActive)
Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust);
else
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust);
}
public bool OnReleased(GlobalAction action) => false;

View File

@ -116,7 +116,7 @@ namespace osu.Game.Screens.Play
protected override void Update()
{
// eagerly pause when we lose window focus (if we are locally playing).
if (!game.IsActive && CanPause)
if (!game.IsActive.Value && CanPause)
Pause();
if (!IsPaused)