mirror of
https://github.com/ppy/osu
synced 2025-03-23 03:16:53 +00:00
Merge branch 'master' into fix-intro-race-condition
This commit is contained in:
commit
1f73ad0da5
osu.Game
@ -21,7 +21,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void ParseStreamInto(StreamReader stream, TOutput beatmap);
|
protected abstract void ParseStreamInto(StreamReader stream, TOutput output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class Decoder
|
public abstract class Decoder
|
||||||
|
@ -13,15 +13,15 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
AddDecoder<Beatmap>("{", m => new JsonBeatmapDecoder());
|
AddDecoder<Beatmap>("{", m => new JsonBeatmapDecoder());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ParseStreamInto(StreamReader stream, Beatmap beatmap)
|
protected override void ParseStreamInto(StreamReader stream, Beatmap output)
|
||||||
{
|
{
|
||||||
stream.BaseStream.Position = 0;
|
stream.BaseStream.Position = 0;
|
||||||
stream.DiscardBufferedData();
|
stream.DiscardBufferedData();
|
||||||
|
|
||||||
stream.ReadToEnd().DeserializeInto(beatmap);
|
stream.ReadToEnd().DeserializeInto(output);
|
||||||
|
|
||||||
foreach (var hitObject in beatmap.HitObjects)
|
foreach (var hitObject in output.HitObjects)
|
||||||
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
|
hitObject.ApplyDefaults(output.ControlPointInfo, output.BeatmapInfo.BaseDifficulty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
FormatVersion = version;
|
FormatVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ParseStreamInto(StreamReader stream, T beatmap)
|
protected override void ParseStreamInto(StreamReader stream, T output)
|
||||||
{
|
{
|
||||||
Section section = Section.None;
|
Section section = Section.None;
|
||||||
|
|
||||||
@ -33,14 +33,21 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section))
|
if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section))
|
||||||
{
|
{
|
||||||
Logger.Log($"Unknown section \"{line}\" in {beatmap}");
|
Logger.Log($"Unknown section \"{line}\" in {output}");
|
||||||
section = Section.None;
|
section = Section.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParseLine(beatmap, section, line);
|
try
|
||||||
|
{
|
||||||
|
ParseLine(output, section, line);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Error(e, $"Failed to process line \"{line}\" into {output}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ParseLine(SkinConfiguration output, Section section, string line)
|
protected override void ParseLine(SkinConfiguration skin, Section section, string line)
|
||||||
{
|
{
|
||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
@ -22,17 +22,17 @@ namespace osu.Game.Skinning
|
|||||||
switch (pair.Key)
|
switch (pair.Key)
|
||||||
{
|
{
|
||||||
case @"Name":
|
case @"Name":
|
||||||
output.SkinInfo.Name = pair.Value;
|
skin.SkinInfo.Name = pair.Value;
|
||||||
break;
|
break;
|
||||||
case @"Author":
|
case @"Author":
|
||||||
output.SkinInfo.Creator = pair.Value;
|
skin.SkinInfo.Creator = pair.Value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.ParseLine(output, section, line);
|
base.ParseLine(skin, section, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user