2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-12-05 23:38:12 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
using osu.Game.IO.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Formats
|
|
|
|
|
{
|
2018-03-09 20:23:03 +08:00
|
|
|
|
public class JsonBeatmapDecoder : Decoder<Beatmap>
|
2017-12-05 23:38:12 +08:00
|
|
|
|
{
|
|
|
|
|
public static void Register()
|
|
|
|
|
{
|
2018-03-09 20:23:03 +08:00
|
|
|
|
AddDecoder<Beatmap>("{", m => new JsonBeatmapDecoder());
|
2017-12-05 23:38:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-09 20:23:03 +08:00
|
|
|
|
protected override void ParseStreamInto(StreamReader stream, Beatmap beatmap)
|
2017-12-05 23:38:12 +08:00
|
|
|
|
{
|
|
|
|
|
stream.BaseStream.Position = 0;
|
|
|
|
|
stream.DiscardBufferedData();
|
|
|
|
|
|
2017-12-21 12:59:03 +08:00
|
|
|
|
stream.ReadToEnd().DeserializeInto(beatmap);
|
2017-12-06 15:28:34 +08:00
|
|
|
|
|
|
|
|
|
foreach (var hitObject in beatmap.HitObjects)
|
|
|
|
|
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
|
2017-12-05 23:38:12 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|