diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7b4ff3d295..914ecba30d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -183,6 +183,8 @@ namespace osu.Game configSkin.TriggerChange(); LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); + + IsActive.BindValueChanged(updateActiveState, true); } private ExternalLinkOpener externalLinkOpener; @@ -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; diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index 8dae0ab964..7889be493e 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -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) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6b94fa4f98..6d55071070 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index d677ef4e21..19c16541a2 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + +