mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 13:33:52 +08:00
Update in-line with framework IsActive changes
This commit is contained in:
parent
2bf5534bf1
commit
703df77000
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user