1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 02:22:56 +08:00

Merge branch 'master' into master

This commit is contained in:
為什麼 2018-01-11 19:07:46 +09:00 committed by GitHub
commit a6ecc2897a
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() protected override Storyboard GetStoryboard()
{ {
if (BeatmapInfo?.Path == null && BeatmapSetInfo?.StoryboardFile == null)
return new Storyboard();
try 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 using (var beatmap = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path))))
string storyboardFile = BeatmapSetInfo.StoryboardFile ?? BeatmapInfo.Path; {
using (var stream = new StreamReader(store.GetStream(getPathForFile(storyboardFile)))) Decoder decoder = Decoder.GetDecoder(beatmap);
return decoder.GetStoryboardDecoder().DecodeStoryboard(stream);
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 catch
{ {

View File

@ -70,9 +70,10 @@ namespace osu.Game.Beatmaps.Formats
protected abstract void ParseBeatmap(StreamReader stream, Beatmap beatmap); 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(); var storyboard = new Storyboard();
foreach (StreamReader stream in streams)
ParseStoryboard(stream, storyboard); ParseStoryboard(stream, storyboard);
return storyboard; return storyboard;
} }