1
0
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:
Dan Balasescu 2022-11-10 12:46:52 +09:00 committed by GitHub
commit 46d4fc0279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -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
);
}

View File

@ -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;
}