mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Apply changes in line with master changes
This commit is contained in:
@ -158,8 +158,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
using (var stream = Resource.OpenResource(filename))
|
using (var stream = Resource.OpenResource(filename))
|
||||||
using (var sr = new StreamReader(stream))
|
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 ms = new MemoryStream())
|
||||||
using (var sw = new StreamWriter(ms))
|
using (var sw = new StreamWriter(ms))
|
||||||
using (var sr2 = new StreamReader(ms))
|
using (var sr2 = new StreamReader(ms))
|
||||||
@ -168,7 +168,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
sw.Flush();
|
sw.Flush();
|
||||||
|
|
||||||
ms.Position = 0;
|
ms.Position = 0;
|
||||||
return (legacyDecoded, new OsuJsonDecoder().Decode(sr2));
|
return (legacyDecoded, new OsuJsonDecoder().DecodeBeatmap(sr2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,34 +3,33 @@
|
|||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using osu.Game.IO.Serialization;
|
using osu.Game.IO.Serialization;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Formats
|
namespace osu.Game.Beatmaps.Formats
|
||||||
{
|
{
|
||||||
public class OsuJsonDecoder : BeatmapDecoder
|
public class OsuJsonDecoder : Decoder
|
||||||
{
|
{
|
||||||
public static void Register()
|
public static void Register()
|
||||||
{
|
{
|
||||||
AddDecoder<OsuJsonDecoder>("{");
|
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.BaseStream.Position = 0;
|
||||||
stream.DiscardBufferedData();
|
stream.DiscardBufferedData();
|
||||||
|
|
||||||
try
|
stream.ReadToEnd().DeserializeInto(beatmap);
|
||||||
{
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var hitObject in beatmap.HitObjects)
|
foreach (var hitObject in beatmap.HitObjects)
|
||||||
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
|
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void ParseStoryboard(StreamReader stream, Storyboard storyboard)
|
||||||
|
{
|
||||||
|
// throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user