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:
commit
42039a0ce9
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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" />
|
||||
|
@ -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" />
|
||||
|
Loading…
Reference in New Issue
Block a user