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

Fix TestWorkingBeatmap broken by attempting to load storyboard

This commit is contained in:
Dean Herbert 2017-07-20 09:22:39 +09:00
parent d75e439f94
commit d69470f2ae
4 changed files with 12 additions and 9 deletions

View File

@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Beatmaps
public class TestWorkingBeatmap : WorkingBeatmap
{
public TestWorkingBeatmap(Beatmap beatmap)
: base(beatmap.BeatmapInfo)
: base(beatmap.BeatmapInfo, true)
{
this.beatmap = beatmap;
}

View File

@ -22,14 +22,17 @@ namespace osu.Game.Beatmaps
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
public readonly bool WithStoryboard;
/// <summary>
/// Denotes whether extras like storyboards have been loaded for this <see cref="WorkingBeatmap"/>.
/// </summary>
public bool FullyLoaded { get; protected set; }
protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool withStoryboard = false)
protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool fullyLoaded = false)
{
BeatmapInfo = beatmapInfo;
BeatmapSetInfo = beatmapInfo.BeatmapSet;
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
WithStoryboard = withStoryboard;
FullyLoaded = fullyLoaded;
Mods.ValueChanged += mods => applyRateAdjustments();
}

View File

@ -14,8 +14,8 @@ namespace osu.Game.Database
{
private readonly BeatmapDatabase database;
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool withStoryboard = false)
: base(beatmapInfo, withStoryboard)
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool fullyLoaded = false)
: base(beatmapInfo, fullyLoaded)
{
this.database = database;
}
@ -37,7 +37,7 @@ namespace osu.Game.Database
beatmap = decoder.Decode(stream);
}
if (beatmap == null || !WithStoryboard || BeatmapSetInfo.StoryboardFile == null)
if (beatmap == null || !FullyLoaded || BeatmapSetInfo.StoryboardFile == null)
return beatmap;
using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))

View File

@ -81,8 +81,8 @@ namespace osu.Game.Screens.Play
try
{
if (!Beatmap.Value.WithStoryboard)
// we need to ensure the storyboard is loaded.
if (!Beatmap.Value.FullyLoaded)
// we need to ensure extras like storyboards are loaded.
Beatmap.Value = beatmaps.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo, withStoryboard: true);
if (Beatmap.Value.Beatmap == null)