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

Ensure other full-screen overlays are closed when direct is open (and vice-versa)

This commit is contained in:
Dean Herbert 2017-08-25 10:51:28 +09:00
parent cf251b70c7
commit 2dd3e51373

View File

@ -226,6 +226,23 @@ namespace osu.Game
dependencies.Cache(notificationOverlay);
dependencies.Cache(dialogOverlay);
// 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;
}
};
}
// 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;