mirror of
https://github.com/ppy/osu.git
synced 2024-11-08 03:37:35 +08:00
Fix home button not closing login and now playing overlays (#6758)
Fix home button not closing login and now playing overlays Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
e32f88c770
@ -102,8 +102,6 @@ namespace osu.Game
|
||||
|
||||
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||
|
||||
private readonly List<VisibilityContainer> toolbarElements = new List<VisibilityContainer>();
|
||||
|
||||
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
|
||||
|
||||
public OsuGame(string[] args = null)
|
||||
@ -134,17 +132,13 @@ namespace osu.Game
|
||||
/// <summary>
|
||||
/// Close all game-wide overlays.
|
||||
/// </summary>
|
||||
/// <param name="hideToolbarElements">Whether the toolbar (and accompanying controls) should also be hidden.</param>
|
||||
public void CloseAllOverlays(bool hideToolbarElements = true)
|
||||
/// <param name="hideToolbar">Whether the toolbar should also be hidden.</param>
|
||||
public void CloseAllOverlays(bool hideToolbar = true)
|
||||
{
|
||||
foreach (var overlay in overlays)
|
||||
overlay.Hide();
|
||||
|
||||
if (hideToolbarElements)
|
||||
{
|
||||
foreach (var overlay in toolbarElements)
|
||||
overlay.Hide();
|
||||
}
|
||||
if (hideToolbar) Toolbar.Hide();
|
||||
}
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
@ -572,11 +566,7 @@ namespace osu.Game
|
||||
CloseAllOverlays(false);
|
||||
menuScreen?.MakeCurrent();
|
||||
},
|
||||
}, d =>
|
||||
{
|
||||
topMostOverlayContent.Add(d);
|
||||
toolbarElements.Add(d);
|
||||
});
|
||||
}, topMostOverlayContent.Add);
|
||||
|
||||
loadComponentSingleFile(volume = new VolumeOverlay(), leftFloatingOverlayContent.Add, true);
|
||||
|
||||
@ -615,11 +605,7 @@ namespace osu.Game
|
||||
GetToolbarHeight = () => ToolbarOffset,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
}, d =>
|
||||
{
|
||||
rightFloatingOverlayContent.Add(d);
|
||||
toolbarElements.Add(d);
|
||||
}, true);
|
||||
}, rightFloatingOverlayContent.Add, true);
|
||||
|
||||
loadComponentSingleFile(new AccountCreationOverlay(), topMostOverlayContent.Add, true);
|
||||
loadComponentSingleFile(new DialogOverlay(), topMostOverlayContent.Add, true);
|
||||
@ -629,8 +615,8 @@ namespace osu.Game
|
||||
|
||||
Add(externalLinkOpener = new ExternalLinkOpener());
|
||||
|
||||
// side overlays which cancel each other.
|
||||
var singleDisplaySideOverlays = new OverlayContainer[] { Settings, notifications };
|
||||
overlays.AddRange(singleDisplaySideOverlays);
|
||||
|
||||
foreach (var overlay in singleDisplaySideOverlays)
|
||||
{
|
||||
@ -644,7 +630,6 @@ 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 };
|
||||
overlays.AddRange(informationalOverlays);
|
||||
|
||||
foreach (var overlay in informationalOverlays)
|
||||
{
|
||||
@ -658,7 +643,6 @@ namespace osu.Game
|
||||
|
||||
// ensure only one of these overlays are open at once.
|
||||
var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, social, direct, changelogOverlay };
|
||||
overlays.AddRange(singleDisplayOverlays);
|
||||
|
||||
foreach (var overlay in singleDisplayOverlays)
|
||||
{
|
||||
@ -759,6 +743,9 @@ namespace osu.Game
|
||||
if (cache)
|
||||
dependencies.Cache(d);
|
||||
|
||||
if (d is OverlayContainer overlay)
|
||||
overlays.Add(overlay);
|
||||
|
||||
// schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached).
|
||||
// with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile,
|
||||
// we could avoid the need for scheduling altogether.
|
||||
|
Loading…
Reference in New Issue
Block a user