1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Make Player load async.

This commit is contained in:
Dean Herbert 2016-12-15 21:18:30 +09:00
parent 9557821776
commit 8d800dac99

View File

@ -150,12 +150,26 @@ namespace osu.Game.Screens.Select
}; };
} }
Player player;
private void start() private void start()
{ {
Push(new Player if (player != null)
return;
player = new Player
{ {
BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
PreferredPlayMode = playMode.Value PreferredPlayMode = playMode.Value
};
player.Preload(Game, delegate
{
if (!Push(player))
{
player = null;
//error occured?
}
}); });
} }
@ -206,6 +220,8 @@ namespace osu.Game.Screens.Select
protected override void OnResuming(GameMode last) protected override void OnResuming(GameMode last)
{ {
player = null;
changeBackground(Beatmap); changeBackground(Beatmap);
ensurePlayingSelected(); ensurePlayingSelected();
base.OnResuming(last); base.OnResuming(last);