mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 16:13:34 +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();
|
configSkin.TriggerChange();
|
||||||
|
|
||||||
LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust);
|
LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust);
|
||||||
|
|
||||||
|
IsActive.BindValueChanged(updateActiveState, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ExternalLinkOpener externalLinkOpener;
|
private ExternalLinkOpener externalLinkOpener;
|
||||||
@ -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;
|
||||||
|
@ -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)
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
<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="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -105,8 +105,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
<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="ppy.osu.Framework.iOS" Version="2019.215.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.220.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user