Update null background handling

This commit is contained in:
Drew DeVault 2017-01-30 09:44:02 -05:00
parent 66d104394f
commit 0a81fdbd10
2 changed files with 9 additions and 11 deletions

View File

@ -24,14 +24,17 @@ namespace osu.Game.Screens.Backgrounds
}
set
{
if (beatmap == value)
if (beatmap == value && beatmap != null)
return;
beatmap = value;
Schedule(() =>
{
Background newBackground = new BeatmapBackground(beatmap);
Background newBackground;
if (beatmap == null)
newBackground = new Background(@"Backgrounds/bg1");
else
newBackground = new BeatmapBackground(beatmap);
newBackground.Preload(Game, delegate
{
@ -55,8 +58,6 @@ namespace osu.Game.Screens.Backgrounds
public BackgroundModeBeatmap(WorkingBeatmap beatmap)
{
Beatmap = beatmap;
if (beatmap == null)
Add(background = new Background(@"Backgrounds/bg1"));
}
public void BlurTo(Vector2 sigma, double duration)

View File

@ -298,18 +298,15 @@ namespace osu.Game.Screens.Select
private void changeBackground(WorkingBeatmap beatmap)
{
if (beatmap == null)
return;
var backgroundModeBeatmap = Background as BackgroundModeBeatmap;
if (backgroundModeBeatmap != null)
{
backgroundModeBeatmap.Beatmap = beatmap;
// TODO: Remove this once we have non-nullable Beatmap
(Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000);
backgroundModeBeatmap.BlurTo(BACKGROUND_BLUR, 1000);
}
beatmapInfoWedge.UpdateBeatmap(beatmap);
if (beatmap != null)
beatmapInfoWedge.UpdateBeatmap(beatmap);
}
/// <summary>