mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 12:23:13 +08:00
Load SeasonalBackgroundLoader asynchronously
This commit is contained in:
parent
c1d03a5bac
commit
81ebcd8796
@ -25,6 +25,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
private Bindable<Skin> skin;
|
private Bindable<Skin> skin;
|
||||||
private Bindable<BackgroundSource> mode;
|
private Bindable<BackgroundSource> mode;
|
||||||
private Bindable<IntroSequence> introSequence;
|
private Bindable<IntroSequence> introSequence;
|
||||||
|
private readonly SeasonalBackgroundLoader seasonalBackgroundLoader = new SeasonalBackgroundLoader();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
||||||
@ -50,7 +51,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
currentDisplay = RNG.Next(0, background_count);
|
currentDisplay = RNG.Next(0, background_count);
|
||||||
|
|
||||||
display(createBackground());
|
LoadComponentAsync(seasonalBackgroundLoader, _ => LoadComponentAsync(createBackground(), display));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(Background newBackground)
|
private void display(Background newBackground)
|
||||||
@ -90,6 +91,10 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
{
|
{
|
||||||
switch (mode.Value)
|
switch (mode.Value)
|
||||||
{
|
{
|
||||||
|
case BackgroundSource.Seasonal:
|
||||||
|
newBackground = seasonalBackgroundLoader.LoadBackground(backgroundName);
|
||||||
|
break;
|
||||||
|
|
||||||
case BackgroundSource.Beatmap:
|
case BackgroundSource.Beatmap:
|
||||||
newBackground = new BeatmapBackground(beatmap.Value, backgroundName);
|
newBackground = new BeatmapBackground(beatmap.Value, backgroundName);
|
||||||
break;
|
break;
|
||||||
@ -100,7 +105,18 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
newBackground = new Background(backgroundName);
|
{
|
||||||
|
switch (mode.Value)
|
||||||
|
{
|
||||||
|
case BackgroundSource.Seasonal:
|
||||||
|
newBackground = seasonalBackgroundLoader.LoadBackground(backgroundName);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
newBackground = new Background(backgroundName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
newBackground.Depth = currentDisplay;
|
newBackground.Depth = currentDisplay;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user