mirror of
https://github.com/osukey/osukey.git
synced 2025-05-31 02:17:34 +09:00
Move MainMenu initialisation from ctor to load
This commit is contained in:
parent
bebb635ca1
commit
e91c07209f
@ -25,7 +25,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
public class MainMenu : OsuScreen
|
public class MainMenu : OsuScreen
|
||||||
{
|
{
|
||||||
private readonly ButtonSystem buttons;
|
private ButtonSystem buttons;
|
||||||
|
|
||||||
public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial;
|
public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial;
|
||||||
|
|
||||||
@ -35,17 +35,26 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private Screen songSelect;
|
private Screen songSelect;
|
||||||
|
|
||||||
private readonly MenuSideFlashes sideFlashes;
|
private MenuSideFlashes sideFlashes;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; }
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
||||||
|
|
||||||
public MainMenu()
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(OsuGame game = null)
|
||||||
{
|
{
|
||||||
sideFlashes = new MenuSideFlashes();
|
if (host.CanExit)
|
||||||
|
AddInternal(new ExitConfirmOverlay { Action = this.Exit });
|
||||||
|
|
||||||
|
AddRangeInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
new ParallaxContainer
|
||||||
|
{
|
||||||
|
ParallaxAmount = 0.01f,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
buttons = new ButtonSystem
|
buttons = new ButtonSystem
|
||||||
{
|
{
|
||||||
OnChart = delegate { this.Push(new ChartListing()); },
|
OnChart = delegate { this.Push(new ChartListing()); },
|
||||||
@ -54,7 +63,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
OnSolo = onSolo,
|
OnSolo = onSolo,
|
||||||
OnMulti = delegate { this.Push(new Multiplayer()); },
|
OnMulti = delegate { this.Push(new Multiplayer()); },
|
||||||
OnExit = this.Exit,
|
OnExit = this.Exit,
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sideFlashes = new MenuSideFlashes(),
|
||||||
|
});
|
||||||
|
|
||||||
buttons.StateChanged += state =>
|
buttons.StateChanged += state =>
|
||||||
{
|
{
|
||||||
@ -69,26 +82,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
|
||||||
private void load(OsuGame game = null)
|
|
||||||
{
|
|
||||||
if (host.CanExit)
|
|
||||||
{
|
|
||||||
AddInternal(new ExitConfirmOverlay
|
|
||||||
{
|
|
||||||
Action = this.Exit,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
AddInternal(new ParallaxContainer
|
|
||||||
{
|
|
||||||
ParallaxAmount = 0.01f,
|
|
||||||
Child = buttons,
|
|
||||||
});
|
|
||||||
|
|
||||||
AddInternal(sideFlashes);
|
|
||||||
|
|
||||||
if (game != null)
|
if (game != null)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user