1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Give the dummy beatmap a background

This commit is contained in:
Dean Herbert 2017-07-18 17:59:43 +09:00
parent 007b343854
commit 3289d93f22
2 changed files with 10 additions and 3 deletions

View File

@ -11,7 +11,9 @@ namespace osu.Game.Beatmaps
{ {
internal class DummyWorkingBeatmap : WorkingBeatmap internal class DummyWorkingBeatmap : WorkingBeatmap
{ {
public DummyWorkingBeatmap() private readonly OsuGame game;
public DummyWorkingBeatmap(OsuGame game)
: base(new BeatmapInfo : base(new BeatmapInfo
{ {
Metadata = new BeatmapMetadata Metadata = new BeatmapMetadata
@ -24,6 +26,7 @@ namespace osu.Game.Beatmaps
Difficulty = new BeatmapDifficulty(), Difficulty = new BeatmapDifficulty(),
}) })
{ {
this.game = game;
} }
protected override Beatmap GetBeatmap() => new Beatmap protected override Beatmap GetBeatmap() => new Beatmap
@ -31,7 +34,7 @@ namespace osu.Game.Beatmaps
HitObjects = new List<HitObject>(), HitObjects = new List<HitObject>(),
}; };
protected override Texture GetBackground() => null; protected override Texture GetBackground() => game.Textures.Get(@"Backgrounds/bg4");
protected override Track GetTrack() => new TrackVirtual(); protected override Track GetTrack() => new TrackVirtual();
} }

View File

@ -41,6 +41,8 @@ namespace osu.Game.Screens
private SampleChannel sampleExit; private SampleChannel sampleExit;
private DummyWorkingBeatmap dummyBeatmap;
public WorkingBeatmap Beatmap public WorkingBeatmap Beatmap
{ {
get get
@ -49,13 +51,15 @@ namespace osu.Game.Screens
} }
set set
{ {
beatmap.Value = value ?? new DummyWorkingBeatmap(); beatmap.Value = value ?? dummyBeatmap;
} }
} }
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuGameBase game, OsuGame osuGame, AudioManager audio) private void load(OsuGameBase game, OsuGame osuGame, AudioManager audio)
{ {
dummyBeatmap = new DummyWorkingBeatmap(osuGame);
if (game != null) if (game != null)
{ {
//if we were given a beatmap at ctor time, we want to pass this on to the game-wide beatmap. //if we were given a beatmap at ctor time, we want to pass this on to the game-wide beatmap.