mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Fix backgrounds not correctly handling initial async load
This commit is contained in:
@ -36,9 +36,11 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
beatmap = value;
|
beatmap = value;
|
||||||
|
|
||||||
Schedule(() =>
|
Schedule(() => { LoadComponentAsync(new BeatmapBackground(beatmap), b => Schedule(() => backgroundLoaded(b))); });
|
||||||
{
|
}
|
||||||
LoadComponentAsync(new BeatmapBackground(beatmap), b => Schedule(() =>
|
}
|
||||||
|
|
||||||
|
private void backgroundLoaded(BeatmapBackground b)
|
||||||
{
|
{
|
||||||
float newDepth = 0;
|
float newDepth = 0;
|
||||||
if (Background != null)
|
if (Background != null)
|
||||||
@ -53,9 +55,13 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
fadeContainer.Add(Background = b);
|
fadeContainer.Add(Background = b);
|
||||||
Background.BlurSigma = BlurTarget;
|
Background.BlurSigma = BlurTarget;
|
||||||
StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground);
|
StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground);
|
||||||
}));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
if (beatmap != null)
|
||||||
|
backgroundLoaded(new BeatmapBackground(beatmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
|
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
currentDisplay = RNG.Next(0, background_count);
|
currentDisplay = RNG.Next(0, background_count);
|
||||||
|
|
||||||
Next();
|
display(createBackground());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(Background newBackground)
|
private void display(Background newBackground)
|
||||||
@ -51,7 +51,10 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
public void Next()
|
public void Next()
|
||||||
{
|
{
|
||||||
nextTask?.Cancel();
|
nextTask?.Cancel();
|
||||||
nextTask = Scheduler.AddDelayed(() =>
|
nextTask = Scheduler.AddDelayed(() => { LoadComponentAsync(createBackground(), display); }, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Background createBackground()
|
||||||
{
|
{
|
||||||
Background background;
|
Background background;
|
||||||
|
|
||||||
@ -62,8 +65,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
background.Depth = currentDisplay;
|
background.Depth = currentDisplay;
|
||||||
|
|
||||||
LoadComponentAsync(background, display);
|
return background;
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SkinnedBackground : Background
|
private class SkinnedBackground : Background
|
||||||
|
Reference in New Issue
Block a user