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