1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Merge pull request #4296 from smoogipoo/isactive-changes

Update in-line with framework IsActive changes
This commit is contained in:
Dean Herbert 2019-02-20 16:55:06 +09:00 committed by GitHub
commit 42039a0ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 13 deletions

View File

@ -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;

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)

View File

@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.215.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.220.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />

View File

@ -105,8 +105,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.215.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.215.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.220.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.220.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />