From 703df770002511ab2bb58f20263117b7184144c6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 19:16:03 +0900 Subject: [PATCH 1/3] Update in-line with framework IsActive changes --- osu.Game/OsuGame.cs | 16 +++++++--------- osu.Game/Screens/Play/PauseContainer.cs | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7b4ff3d295..e3b3a9ed79 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -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; 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) From 49eadcb575fd9a37c322f407fd0aa77a846864c9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 19:44:09 +0900 Subject: [PATCH 2/3] Update active state immediately + fix potential nullref --- osu.Game/OsuGame.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e3b3a9ed79..914ecba30d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -120,8 +120,6 @@ namespace osu.Game forwardLoggedErrorsToNotifications(); RavenLogger = new RavenLogger(this); - - IsActive.BindValueChanged(updateActiveState); } public void ToggleSettings() => settings.ToggleVisibility(); @@ -185,6 +183,8 @@ namespace osu.Game configSkin.TriggerChange(); LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); + + IsActive.BindValueChanged(updateActiveState, true); } private ExternalLinkOpener externalLinkOpener; From b1337ed07fc2317ee8c1266e9fe394eb882a0f1e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Feb 2019 16:09:29 +0900 Subject: [PATCH 3/3] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 @@ - - + +