2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-09-10 06:43:30 +08:00
|
|
|
|
using osu.Game.IO;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.IO.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Formats
|
|
|
|
|
{
|
|
|
|
|
public class JsonBeatmapDecoder : Decoder<Beatmap>
|
|
|
|
|
{
|
|
|
|
|
public static void Register()
|
|
|
|
|
{
|
2022-06-24 20:25:23 +08:00
|
|
|
|
AddDecoder<Beatmap>("{", _ => new JsonBeatmapDecoder());
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-10 06:43:30 +08:00
|
|
|
|
protected override void ParseStreamInto(LineBufferedReader stream, Beatmap output)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-04-20 17:32:24 +08:00
|
|
|
|
stream.ReadToEnd().DeserializeInto(output);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-04-20 17:32:24 +08:00
|
|
|
|
foreach (var hitObject in output.HitObjects)
|
2021-10-02 11:34:29 +08:00
|
|
|
|
hitObject.ApplyDefaults(output.ControlPointInfo, output.Difficulty);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|