1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 15:12:57 +08:00

Add fallback texture of beatmap when getting null;

This commit is contained in:
Huo Yaoyuan 2016-11-06 05:37:55 +08:00
parent 0c6825bb20
commit d63e3b6724

View File

@ -26,6 +26,7 @@ namespace osu.Game.Overlays
private DragBar progress; private DragBar progress;
private TextAwesome playButton, listButton; private TextAwesome playButton, listButton;
private SpriteText title, artist; private SpriteText title, artist;
private Texture fallbackTexture;
private TrackManager trackManager; private TrackManager trackManager;
private List<BeatmapSetInfo> playList; private List<BeatmapSetInfo> playList;
@ -182,7 +183,7 @@ namespace osu.Game.Overlays
beatmapSource.ValueChanged += workingChanged; beatmapSource.ValueChanged += workingChanged;
playList = database.GetAllWithChildren<BeatmapSetInfo>(); playList = database.GetAllWithChildren<BeatmapSetInfo>();
backgroundSprite = getScaledSprite(game.Textures.Get(@"Backgrounds/bg4")); backgroundSprite = getScaledSprite(fallbackTexture = game.Textures.Get(@"Backgrounds/bg4"));
AddInternal(backgroundSprite); AddInternal(backgroundSprite);
} }
@ -263,7 +264,7 @@ namespace osu.Game.Overlays
title.Text = metadata.TitleUnicode ?? metadata.Title; title.Text = metadata.TitleUnicode ?? metadata.Title;
artist.Text = metadata.ArtistUnicode ?? metadata.Artist; artist.Text = metadata.ArtistUnicode ?? metadata.Artist;
Sprite newBackground = getScaledSprite(beatmap.Background); Sprite newBackground = getScaledSprite(beatmap.Background ?? fallbackTexture);
Add(newBackground); Add(newBackground);