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

View File

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