1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 18:47:25 +08:00

Merge pull request #1190 from peppy/concurrent-overlay-limits

Ensure other full-screen overlays are closed when direct is open (and vice-versa)
This commit is contained in:
Dan Balasescu 2017-08-25 15:00:40 +09:00 committed by GitHub
commit 11fd91bc68

View File

@ -226,9 +226,21 @@ namespace osu.Game
dependencies.Cache(notificationOverlay);
dependencies.Cache(dialogOverlay);
// ensure both overlays aren't presented at the same time
chat.StateChanged += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State;
social.StateChanged += (container, state) => chat.State = state == Visibility.Visible ? Visibility.Hidden : chat.State;
// ensure only one of these overlays are open at once.
var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
foreach (var overlay in singleDisplayOverlays)
{
overlay.StateChanged += (container, state) =>
{
if (state == Visibility.Hidden) return;
foreach (var c in singleDisplayOverlays)
{
if (c == container) continue;
c.State = Visibility.Hidden;
}
};
}
LoadComponentAsync(Toolbar = new Toolbar
{