1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-25 00:20:49 +08:00

Give song select a better default background whecn the beatmap's can't be loaded

This commit is contained in:
Dean Herbert
2017-07-19 13:33:00 +09:00
Unverified
parent d0dea33faa
commit 8e8767cd37
2 changed files with 7 additions and 5 deletions
@@ -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");
}
}
}
+1 -1
View File
@@ -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;