mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:42:54 +08:00
Apply changes in line with master changes
This commit is contained in:
parent
f6552da406
commit
bfa4f1a2c3
@ -158,8 +158,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
using (var stream = Resource.OpenResource(filename))
|
||||
using (var sr = new StreamReader(stream))
|
||||
{
|
||||
var legacyDecoded = new OsuLegacyDecoder().Decode(sr);
|
||||
|
||||
var legacyDecoded = new LegacyBeatmapDecoder().DecodeBeatmap(sr);
|
||||
using (var ms = new MemoryStream())
|
||||
using (var sw = new StreamWriter(ms))
|
||||
using (var sr2 = new StreamReader(ms))
|
||||
@ -168,7 +168,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
sw.Flush();
|
||||
|
||||
ms.Position = 0;
|
||||
return (legacyDecoded, new OsuJsonDecoder().Decode(sr2));
|
||||
return (legacyDecoded, new OsuJsonDecoder().DecodeBeatmap(sr2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,34 +3,33 @@
|
||||
|
||||
using System.IO;
|
||||
using osu.Game.IO.Serialization;
|
||||
using osu.Game.Storyboards;
|
||||
|
||||
namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
public class OsuJsonDecoder : BeatmapDecoder
|
||||
public class OsuJsonDecoder : Decoder
|
||||
{
|
||||
public static void Register()
|
||||
{
|
||||
AddDecoder<OsuJsonDecoder>("{");
|
||||
}
|
||||
|
||||
protected override void ParseFile(StreamReader stream, Beatmap beatmap)
|
||||
public override Decoder GetStoryboardDecoder() => this;
|
||||
|
||||
protected override void ParseBeatmap(StreamReader stream, Beatmap beatmap)
|
||||
{
|
||||
stream.BaseStream.Position = 0;
|
||||
stream.DiscardBufferedData();
|
||||
|
||||
try
|
||||
{
|
||||
string fullText = stream.ReadToEnd();
|
||||
fullText.DeserializeInto(beatmap);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Temporary because storyboards are deserialized into beatmaps at the moment
|
||||
// This try-catch shouldn't exist in the future
|
||||
}
|
||||
stream.ReadToEnd().DeserializeInto(beatmap);
|
||||
|
||||
foreach (var hitObject in beatmap.HitObjects)
|
||||
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
|
||||
}
|
||||
|
||||
protected override void ParseStoryboard(StreamReader stream, Storyboard storyboard)
|
||||
{
|
||||
// throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user