mirror of
https://github.com/ppy/osu.git
synced 2025-01-22 18:53:22 +08:00
Merge pull request #21167 from peppy/fix-storyboard-variables
Fix some issues with storyboard variables
This commit is contained in:
commit
46d4fc0279
@ -130,14 +130,20 @@ namespace osu.Game.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
|
||||
protected KeyValuePair<string, string> SplitKeyVal(string line, char separator = ':')
|
||||
protected KeyValuePair<string, string> SplitKeyVal(string line, char separator = ':', bool shouldTrim = true)
|
||||
{
|
||||
string[] split = line.Split(separator, 2);
|
||||
|
||||
if (shouldTrim)
|
||||
{
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
split[i] = split[i].Trim();
|
||||
}
|
||||
|
||||
return new KeyValuePair<string, string>
|
||||
(
|
||||
split[0].Trim(),
|
||||
split.Length > 1 ? split[1].Trim() : string.Empty
|
||||
split[0],
|
||||
split.Length > 1 ? split[1] : string.Empty
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,8 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
private void handleEvents(string line)
|
||||
{
|
||||
decodeVariables(ref line);
|
||||
|
||||
int depth = 0;
|
||||
|
||||
foreach (char c in line)
|
||||
@ -91,8 +93,6 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
line = line.Substring(depth);
|
||||
|
||||
decodeVariables(ref line);
|
||||
|
||||
string[] split = line.Split(',');
|
||||
|
||||
if (depth == 0)
|
||||
@ -349,7 +349,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
private void handleVariables(string line)
|
||||
{
|
||||
var pair = SplitKeyVal(line, '=');
|
||||
var pair = SplitKeyVal(line, '=', false);
|
||||
variables[pair.Key] = pair.Value;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user