mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Add loading screen.
This commit is contained in:
@ -54,32 +54,10 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private Footer footer;
|
||||
|
||||
Player player;
|
||||
OsuScreen player;
|
||||
|
||||
FilterControl filter;
|
||||
|
||||
private void start()
|
||||
{
|
||||
if (player != null || Beatmap == null)
|
||||
return;
|
||||
|
||||
//in the future we may want to move this logic to a PlayerLoader gamemode or similar, so we can rely on the SongSelect transition
|
||||
//and provide a better loading experience (at the moment song select is still accepting input during preload).
|
||||
player = new Player
|
||||
{
|
||||
BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
|
||||
PreferredPlayMode = playMode.Value
|
||||
};
|
||||
|
||||
player.Preload(Game, delegate
|
||||
{
|
||||
if (!Push(player))
|
||||
{
|
||||
player = null;
|
||||
//error occured?
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game,
|
||||
OsuGame osuGame, OsuColour colours)
|
||||
@ -132,10 +110,20 @@ namespace osu.Game.Screens.Select
|
||||
Right = 20,
|
||||
},
|
||||
},
|
||||
footer = new Footer()
|
||||
footer = new Footer
|
||||
{
|
||||
OnBack = Exit,
|
||||
OnStart = start,
|
||||
OnStart = () =>
|
||||
{
|
||||
if (player != null || Beatmap == null)
|
||||
return;
|
||||
|
||||
(player = new PlayerLoader(new Player
|
||||
{
|
||||
BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
|
||||
PreferredPlayMode = playMode.Value
|
||||
})).Preload(Game, l => Push(player));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -276,6 +264,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
backgroundModeBeatmap.Beatmap = beatmap;
|
||||
backgroundModeBeatmap.BlurTo(background_blur, 1000);
|
||||
backgroundModeBeatmap.FadeTo(1, 250);
|
||||
}
|
||||
|
||||
if (beatmap != null)
|
||||
@ -346,7 +335,7 @@ namespace osu.Game.Screens.Select
|
||||
var group = new BeatmapGroup(beatmap)
|
||||
{
|
||||
SelectionChanged = selectionChanged,
|
||||
StartRequested = b => start()
|
||||
StartRequested = b => footer.StartButton.TriggerClick()
|
||||
};
|
||||
|
||||
//for the time being, let's completely load the difficulty panels in the background.
|
||||
@ -382,7 +371,7 @@ namespace osu.Game.Screens.Select
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.Enter:
|
||||
start();
|
||||
footer.StartButton.TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user