mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:43:20 +08:00
Give song select a better default background whecn the beatmap's can't be loaded
This commit is contained in:
parent
d0dea33faa
commit
8e8767cd37
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using OpenTK;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
@ -26,11 +27,12 @@ namespace osu.Game.Screens.Backgrounds
|
||||
{
|
||||
if (beatmap == value && beatmap != null)
|
||||
return;
|
||||
|
||||
beatmap = value;
|
||||
|
||||
Schedule(() =>
|
||||
{
|
||||
var newBackground = beatmap == null ? new Background(@"Backgrounds/bg1") : new BeatmapBackground(beatmap);
|
||||
var newBackground = new BeatmapBackground(beatmap);
|
||||
|
||||
LoadComponentAsync(newBackground, delegate
|
||||
{
|
||||
@ -51,7 +53,7 @@ namespace osu.Game.Screens.Backgrounds
|
||||
}
|
||||
}
|
||||
|
||||
public BackgroundScreenBeatmap(WorkingBeatmap beatmap)
|
||||
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
|
||||
{
|
||||
Beatmap = beatmap;
|
||||
}
|
||||
@ -80,9 +82,9 @@ namespace osu.Game.Screens.Backgrounds
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Sprite.Texture = beatmap?.Background;
|
||||
Sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
private BeatmapDatabase database;
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
|
||||
|
||||
private readonly BeatmapCarousel carousel;
|
||||
private TrackManager trackManager;
|
||||
|
Loading…
Reference in New Issue
Block a user