fix load storyboard in osu file

This commit is contained in:
james58899 2018-01-10 18:55:04 +08:00
parent 5b6ddb984f
commit fbffc8bb89
No known key found for this signature in database
GPG Key ID: 7F83E3A11DD5192E
2 changed files with 8 additions and 10 deletions

View File

@ -696,14 +696,9 @@ namespace osu.Game.Beatmaps
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))))
using (var storyboard = new StreamReader(store.GetStream(getPathForFile(BeatmapSetInfo.StoryboardFile))))
return Decoder.GetDecoder(beatmap).GetStoryboardDecoder().DecodeStoryboard(beatmap, storyboard);
}
catch
{

View File

@ -70,10 +70,13 @@ 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;
}