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

Merge pull request #1875 from james58899/fix-storyboard

Fix Storyboard not load in osu file
This commit is contained in:
Dan Balasescu 2018-01-11 17:10:00 +09:00 committed by GitHub
commit 2a983efe0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View File

@ -691,19 +691,19 @@ namespace osu.Game.Beatmaps
protected override Storyboard GetStoryboard()
{
if (BeatmapInfo?.Path == null && BeatmapSetInfo?.StoryboardFile == null)
return new Storyboard();
try
{
Decoder decoder;
using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo?.Path))))
decoder = Decoder.GetDecoder(stream);
// try for .osb first and fall back to .osu
string storyboardFile = BeatmapSetInfo.StoryboardFile ?? BeatmapInfo.Path;
using (var stream = new StreamReader(store.GetStream(getPathForFile(storyboardFile))))
return decoder.GetStoryboardDecoder().DecodeStoryboard(stream);
using (var beatmap = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path))))
{
Decoder decoder = Decoder.GetDecoder(beatmap);
if (BeatmapSetInfo?.StoryboardFile == null)
return decoder.GetStoryboardDecoder().DecodeStoryboard(beatmap);
using (var storyboard = new StreamReader(store.GetStream(getPathForFile(BeatmapSetInfo.StoryboardFile))))
return decoder.GetStoryboardDecoder().DecodeStoryboard(beatmap, storyboard);
}
}
catch
{

View File

@ -70,10 +70,11 @@ namespace osu.Game.Beatmaps.Formats
protected abstract void ParseBeatmap(StreamReader stream, Beatmap beatmap);
public virtual Storyboard DecodeStoryboard(StreamReader stream)
public virtual Storyboard DecodeStoryboard(params StreamReader[] streams)
{
var storyboard = new Storyboard();
ParseStoryboard(stream, storyboard);
foreach (StreamReader stream in streams)
ParseStoryboard(stream, storyboard);
return storyboard;
}