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:
parent
9557821776
commit
8d800dac99
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user