mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +08:00
Preload song select from main menu.
This commit is contained in:
parent
c7fa79b027
commit
6be80c95ae
@ -27,6 +27,7 @@ namespace osu.Game.Screens.Menu
|
||||
internal override bool ShowOverlays => buttons.State != MenuState.Initial;
|
||||
|
||||
private BackgroundScreen background;
|
||||
private Screen songSelect;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => background;
|
||||
|
||||
@ -46,7 +47,7 @@ namespace osu.Game.Screens.Menu
|
||||
OnChart = delegate { Push(new ChartListing()); },
|
||||
OnDirect = delegate { Push(new OnlineListing()); },
|
||||
OnEdit = delegate { Push(new Editor()); },
|
||||
OnSolo = delegate { Push(new PlaySongSelect()); },
|
||||
OnSolo = delegate { Push(consumeSongSelect()); },
|
||||
OnMulti = delegate { Push(new Lobby()); },
|
||||
OnTest = delegate { Push(new TestBrowser()); },
|
||||
OnExit = delegate { Exit(); },
|
||||
@ -62,6 +63,24 @@ namespace osu.Game.Screens.Menu
|
||||
background.LoadAsync(game);
|
||||
|
||||
buttons.OnSettings = game.ToggleOptions;
|
||||
|
||||
preloadSongSelect();
|
||||
}
|
||||
|
||||
private void preloadSongSelect()
|
||||
{
|
||||
if (songSelect == null)
|
||||
{
|
||||
songSelect = new PlaySongSelect();
|
||||
songSelect.LoadAsync(Game);
|
||||
}
|
||||
}
|
||||
|
||||
private Screen consumeSongSelect()
|
||||
{
|
||||
var s = songSelect;
|
||||
songSelect = null;
|
||||
return s;
|
||||
}
|
||||
|
||||
protected override void OnEntering(Screen last)
|
||||
@ -86,6 +105,9 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
//we may have consumed our preloaded instance, so let's make another.
|
||||
preloadSongSelect();
|
||||
|
||||
const float length = 300;
|
||||
|
||||
buttons.State = MenuState.TopLevel;
|
||||
|
Loading…
Reference in New Issue
Block a user