Centralise caching of components at OsuGame level

This commit is contained in:
Dean Herbert
2019-05-13 17:10:25 +09:00
parent 6e0fbaa96d
commit 4b508915f6
2 changed files with 26 additions and 51 deletions

View File

@ -20,6 +20,7 @@ using osu.Game.Screens.Multi;
using osu.Game.Screens.Select;
using osu.Game.Screens.Tournament;
using osu.Framework.Platform;
using osu.Game.Overlays;
namespace osu.Game.Screens.Menu
{
@ -45,7 +46,7 @@ namespace osu.Game.Screens.Menu
protected override BackgroundScreen CreateBackground() => background;
[BackgroundDependencyLoader(true)]
private void load(OsuGame game = null)
private void load(DirectOverlay direct, SettingsOverlay settings)
{
if (host.CanExit)
AddInternal(new ExitConfirmOverlay { Action = this.Exit });
@ -86,11 +87,8 @@ namespace osu.Game.Screens.Menu
}
};
if (game != null)
{
buttons.OnSettings = game.ToggleSettings;
buttons.OnDirect = game.ToggleDirect;
}
buttons.OnSettings = () => settings?.ToggleVisibility();
buttons.OnDirect = () => direct?.ToggleVisibility();
LoadComponentAsync(background = new BackgroundScreenDefault());
preloadSongSelect();