mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 11:27:24 +08:00
Back to using val...
This commit is contained in:
parent
0728aea6a4
commit
5b5c2e4717
@ -62,34 +62,34 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
Variables,
|
Variables,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleGeneral(Beatmap beatmap, string key, string value)
|
private void handleGeneral(Beatmap beatmap, string key, string val)
|
||||||
{
|
{
|
||||||
var metadata = beatmap.BeatmapInfo.Metadata;
|
var metadata = beatmap.BeatmapInfo.Metadata;
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case @"AudioFilename":
|
case @"AudioFilename":
|
||||||
metadata.AudioFile = value;
|
metadata.AudioFile = val;
|
||||||
break;
|
break;
|
||||||
case @"AudioLeadIn":
|
case @"AudioLeadIn":
|
||||||
beatmap.BeatmapInfo.AudioLeadIn = int.Parse(value);
|
beatmap.BeatmapInfo.AudioLeadIn = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
case @"PreviewTime":
|
case @"PreviewTime":
|
||||||
metadata.PreviewTime = int.Parse(value);
|
metadata.PreviewTime = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
case @"Countdown":
|
case @"Countdown":
|
||||||
beatmap.BeatmapInfo.Countdown = int.Parse(value) == 1;
|
beatmap.BeatmapInfo.Countdown = int.Parse(val) == 1;
|
||||||
break;
|
break;
|
||||||
case @"SampleSet":
|
case @"SampleSet":
|
||||||
defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), value);
|
defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), val);
|
||||||
break;
|
break;
|
||||||
case @"SampleVolume":
|
case @"SampleVolume":
|
||||||
defaultSampleVolume = int.Parse(value);
|
defaultSampleVolume = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
case @"StackLeniency":
|
case @"StackLeniency":
|
||||||
beatmap.BeatmapInfo.StackLeniency = float.Parse(value, NumberFormatInfo.InvariantInfo);
|
beatmap.BeatmapInfo.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"Mode":
|
case @"Mode":
|
||||||
beatmap.BeatmapInfo.RulesetID = int.Parse(value);
|
beatmap.BeatmapInfo.RulesetID = int.Parse(val);
|
||||||
|
|
||||||
switch (beatmap.BeatmapInfo.RulesetID)
|
switch (beatmap.BeatmapInfo.RulesetID)
|
||||||
{
|
{
|
||||||
@ -108,100 +108,100 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case @"LetterboxInBreaks":
|
case @"LetterboxInBreaks":
|
||||||
beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(value) == 1;
|
beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(val) == 1;
|
||||||
break;
|
break;
|
||||||
case @"SpecialStyle":
|
case @"SpecialStyle":
|
||||||
beatmap.BeatmapInfo.SpecialStyle = int.Parse(value) == 1;
|
beatmap.BeatmapInfo.SpecialStyle = int.Parse(val) == 1;
|
||||||
break;
|
break;
|
||||||
case @"WidescreenStoryboard":
|
case @"WidescreenStoryboard":
|
||||||
beatmap.BeatmapInfo.WidescreenStoryboard = int.Parse(value) == 1;
|
beatmap.BeatmapInfo.WidescreenStoryboard = int.Parse(val) == 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEditor(Beatmap beatmap, string key, string value)
|
private void handleEditor(Beatmap beatmap, string key, string val)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case @"Bookmarks":
|
case @"Bookmarks":
|
||||||
beatmap.BeatmapInfo.StoredBookmarks = value;
|
beatmap.BeatmapInfo.StoredBookmarks = val;
|
||||||
break;
|
break;
|
||||||
case @"DistanceSpacing":
|
case @"DistanceSpacing":
|
||||||
beatmap.BeatmapInfo.DistanceSpacing = double.Parse(value, NumberFormatInfo.InvariantInfo);
|
beatmap.BeatmapInfo.DistanceSpacing = double.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"BeatDivisor":
|
case @"BeatDivisor":
|
||||||
beatmap.BeatmapInfo.BeatDivisor = int.Parse(value);
|
beatmap.BeatmapInfo.BeatDivisor = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
case @"GridSize":
|
case @"GridSize":
|
||||||
beatmap.BeatmapInfo.GridSize = int.Parse(value);
|
beatmap.BeatmapInfo.GridSize = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
case @"TimelineZoom":
|
case @"TimelineZoom":
|
||||||
beatmap.BeatmapInfo.TimelineZoom = double.Parse(value, NumberFormatInfo.InvariantInfo);
|
beatmap.BeatmapInfo.TimelineZoom = double.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleMetadata(Beatmap beatmap, string key, string value)
|
private void handleMetadata(Beatmap beatmap, string key, string val)
|
||||||
{
|
{
|
||||||
var metadata = beatmap.BeatmapInfo.Metadata;
|
var metadata = beatmap.BeatmapInfo.Metadata;
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case @"Title":
|
case @"Title":
|
||||||
metadata.Title = value;
|
metadata.Title = val;
|
||||||
break;
|
break;
|
||||||
case @"TitleUnicode":
|
case @"TitleUnicode":
|
||||||
metadata.TitleUnicode = value;
|
metadata.TitleUnicode = val;
|
||||||
break;
|
break;
|
||||||
case @"Artist":
|
case @"Artist":
|
||||||
metadata.Artist = value;
|
metadata.Artist = val;
|
||||||
break;
|
break;
|
||||||
case @"ArtistUnicode":
|
case @"ArtistUnicode":
|
||||||
metadata.ArtistUnicode = value;
|
metadata.ArtistUnicode = val;
|
||||||
break;
|
break;
|
||||||
case @"Creator":
|
case @"Creator":
|
||||||
metadata.Author = value;
|
metadata.Author = val;
|
||||||
break;
|
break;
|
||||||
case @"Version":
|
case @"Version":
|
||||||
beatmap.BeatmapInfo.Version = value;
|
beatmap.BeatmapInfo.Version = val;
|
||||||
break;
|
break;
|
||||||
case @"Source":
|
case @"Source":
|
||||||
beatmap.BeatmapInfo.Metadata.Source = value;
|
beatmap.BeatmapInfo.Metadata.Source = val;
|
||||||
break;
|
break;
|
||||||
case @"Tags":
|
case @"Tags":
|
||||||
beatmap.BeatmapInfo.Metadata.Tags = value;
|
beatmap.BeatmapInfo.Metadata.Tags = val;
|
||||||
break;
|
break;
|
||||||
case @"BeatmapID":
|
case @"BeatmapID":
|
||||||
beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(value);
|
beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
case @"BeatmapSetID":
|
case @"BeatmapSetID":
|
||||||
beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(value);
|
beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(val);
|
||||||
metadata.OnlineBeatmapSetID = int.Parse(value);
|
metadata.OnlineBeatmapSetID = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDifficulty(Beatmap beatmap, string key, string value)
|
private void handleDifficulty(Beatmap beatmap, string key, string val)
|
||||||
{
|
{
|
||||||
var difficulty = beatmap.BeatmapInfo.Difficulty;
|
var difficulty = beatmap.BeatmapInfo.Difficulty;
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case @"HPDrainRate":
|
case @"HPDrainRate":
|
||||||
difficulty.DrainRate = float.Parse(value, NumberFormatInfo.InvariantInfo);
|
difficulty.DrainRate = float.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"CircleSize":
|
case @"CircleSize":
|
||||||
difficulty.CircleSize = float.Parse(value, NumberFormatInfo.InvariantInfo);
|
difficulty.CircleSize = float.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"OverallDifficulty":
|
case @"OverallDifficulty":
|
||||||
difficulty.OverallDifficulty = float.Parse(value, NumberFormatInfo.InvariantInfo);
|
difficulty.OverallDifficulty = float.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"ApproachRate":
|
case @"ApproachRate":
|
||||||
difficulty.ApproachRate = float.Parse(value, NumberFormatInfo.InvariantInfo);
|
difficulty.ApproachRate = float.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"SliderMultiplier":
|
case @"SliderMultiplier":
|
||||||
difficulty.SliderMultiplier = float.Parse(value, NumberFormatInfo.InvariantInfo);
|
difficulty.SliderMultiplier = float.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"SliderTickRate":
|
case @"SliderTickRate":
|
||||||
difficulty.SliderTickRate = float.Parse(value, NumberFormatInfo.InvariantInfo);
|
difficulty.SliderTickRate = float.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,12 +347,12 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleColours(Beatmap beatmap, string key, string value, ref bool hasCustomColours)
|
private void handleColours(Beatmap beatmap, string key, string val, ref bool hasCustomColours)
|
||||||
{
|
{
|
||||||
string[] split = value.Split(',');
|
string[] split = val.Split(',');
|
||||||
|
|
||||||
if (split.Length != 3)
|
if (split.Length != 3)
|
||||||
throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {value}");
|
throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {val}");
|
||||||
|
|
||||||
byte r, g, b;
|
byte r, g, b;
|
||||||
if (!byte.TryParse(split[0], out r) || !byte.TryParse(split[1], out g) || !byte.TryParse(split[2], out b))
|
if (!byte.TryParse(split[0], out r) || !byte.TryParse(split[1], out g) || !byte.TryParse(split[2], out b))
|
||||||
@ -416,7 +416,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
string key = null, value = null;
|
string key = null, val = null;
|
||||||
|
|
||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
@ -426,27 +426,27 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
case Section.Difficulty:
|
case Section.Difficulty:
|
||||||
case Section.Colours:
|
case Section.Colours:
|
||||||
key = line.Remove(line.IndexOf(':')).Trim();
|
key = line.Remove(line.IndexOf(':')).Trim();
|
||||||
value = line.Substring(line.IndexOf(':') + 1).Trim();
|
val = line.Substring(line.IndexOf(':') + 1).Trim();
|
||||||
break;
|
break;
|
||||||
case Section.Variables:
|
case Section.Variables:
|
||||||
key = line.Remove(line.IndexOf('=')).Trim();
|
key = line.Remove(line.IndexOf('=')).Trim();
|
||||||
value = line.Substring(line.IndexOf('=') + 1).Trim();
|
val = line.Substring(line.IndexOf('=') + 1).Trim();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
case Section.General:
|
case Section.General:
|
||||||
handleGeneral(beatmap, key, value);
|
handleGeneral(beatmap, key, val);
|
||||||
break;
|
break;
|
||||||
case Section.Editor:
|
case Section.Editor:
|
||||||
handleEditor(beatmap, key, value);
|
handleEditor(beatmap, key, val);
|
||||||
break;
|
break;
|
||||||
case Section.Metadata:
|
case Section.Metadata:
|
||||||
handleMetadata(beatmap, key, value);
|
handleMetadata(beatmap, key, val);
|
||||||
break;
|
break;
|
||||||
case Section.Difficulty:
|
case Section.Difficulty:
|
||||||
handleDifficulty(beatmap, key, value);
|
handleDifficulty(beatmap, key, val);
|
||||||
break;
|
break;
|
||||||
case Section.Events:
|
case Section.Events:
|
||||||
handleEvents(beatmap, line);
|
handleEvents(beatmap, line);
|
||||||
@ -455,7 +455,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
handleTimingPoints(beatmap, line);
|
handleTimingPoints(beatmap, line);
|
||||||
break;
|
break;
|
||||||
case Section.Colours:
|
case Section.Colours:
|
||||||
handleColours(beatmap, key, value, ref hasCustomColours);
|
handleColours(beatmap, key, val, ref hasCustomColours);
|
||||||
break;
|
break;
|
||||||
case Section.HitObjects:
|
case Section.HitObjects:
|
||||||
var obj = parser.Parse(line);
|
var obj = parser.Parse(line);
|
||||||
@ -465,7 +465,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case Section.Variables:
|
case Section.Variables:
|
||||||
variables[key] = value;
|
variables[key] = val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user