From 8a407a68b3e94f438cc8fea88a319b8db326370f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Nov 2017 18:48:37 +0900 Subject: [PATCH] Ensure only one information overlay is open at once --- osu.Game/OsuGame.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index fc5b607810..e603375e9c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -255,6 +255,22 @@ namespace osu.Game }; } + // eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time. + var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile }; + foreach (var overlay in informationalOverlays) + { + overlay.StateChanged += state => + { + if (state == Visibility.Hidden) return; + + foreach (var c in informationalOverlays) + { + if (c == overlay) continue; + c.State = Visibility.Hidden; + } + }; + } + settings.StateChanged += delegate { switch (settings.State)