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

Handle changes to OverlayActivationMode

This commit is contained in:
Dean Herbert 2019-09-11 17:34:28 +09:00
parent 825a34ecd3
commit 2c09efa23b

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -32,7 +32,7 @@ namespace osu.Game.Graphics.Containers
protected virtual bool DimMainContent => true; protected virtual bool DimMainContent => true;
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private OsuGame osuGame { get; set; } private OsuGame game { get; set; }
[Resolved] [Resolved]
private PreviewTrackManager previewTrackManager { get; set; } private PreviewTrackManager previewTrackManager { get; set; }
@ -42,8 +42,14 @@ namespace osu.Game.Graphics.Containers
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
if (osuGame != null) OverlayActivationMode.ValueChanged += mode =>
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode); {
if (mode.NewValue == OverlayActivation.Disabled)
State.Value = Visibility.Hidden;
};
if (game != null)
OverlayActivationMode.BindTo(game.OverlayActivationMode);
samplePopIn = audio.Samples.Get(@"UI/overlay-pop-in"); samplePopIn = audio.Samples.Get(@"UI/overlay-pop-in");
samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out"); samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out");
@ -137,7 +143,7 @@ namespace osu.Game.Graphics.Containers
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
osuGame?.RemoveBlockingOverlay(this); game?.RemoveBlockingOverlay(this);
} }
} }
} }