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

Merge pull request #1031 from peppy/always-load-storyboard

Remove FullyLoaded logic
This commit is contained in:
Thomas Müller 2017-07-20 21:04:24 +02:00 committed by GitHub
commit 119b4dd04c
5 changed files with 7 additions and 17 deletions

View File

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

View File

@ -22,17 +22,11 @@ namespace osu.Game.Beatmaps
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { }); public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
/// <summary> protected WorkingBeatmap(BeatmapInfo beatmapInfo)
/// 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 fullyLoaded = false)
{ {
BeatmapInfo = beatmapInfo; BeatmapInfo = beatmapInfo;
BeatmapSetInfo = beatmapInfo.BeatmapSet; BeatmapSetInfo = beatmapInfo.BeatmapSet;
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata; Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
FullyLoaded = fullyLoaded;
Mods.ValueChanged += mods => applyRateAdjustments(); Mods.ValueChanged += mods => applyRateAdjustments();
} }

View File

@ -291,7 +291,7 @@ namespace osu.Game.Database
if (beatmapInfo.Metadata == null) if (beatmapInfo.Metadata == null)
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo, withStoryboard); WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo);
previous?.TransferTo(working); previous?.TransferTo(working);

View File

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

View File

@ -70,7 +70,7 @@ namespace osu.Game.Screens.Play
private bool loadedSuccessfully => HitRenderer?.Objects.Any() == true; private bool loadedSuccessfully => HitRenderer?.Objects.Any() == true;
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu) private void load(AudioManager audio, OsuConfigManager config, OsuGame osu)
{ {
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel); dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel); mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
@ -81,10 +81,6 @@ namespace osu.Game.Screens.Play
try try
{ {
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) if (Beatmap.Value.Beatmap == null)
throw new InvalidOperationException("Beatmap was not loaded"); throw new InvalidOperationException("Beatmap was not loaded");