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
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); 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> return new KeyValuePair<string, string>
( (
split[0].Trim(), split[0],
split.Length > 1 ? split[1].Trim() : string.Empty split.Length > 1 ? split[1] : string.Empty
); );
} }

View File

@ -79,6 +79,8 @@ namespace osu.Game.Beatmaps.Formats
private void handleEvents(string line) private void handleEvents(string line)
{ {
decodeVariables(ref line);
int depth = 0; int depth = 0;
foreach (char c in line) foreach (char c in line)
@ -91,8 +93,6 @@ namespace osu.Game.Beatmaps.Formats
line = line.Substring(depth); line = line.Substring(depth);
decodeVariables(ref line);
string[] split = line.Split(','); string[] split = line.Split(',');
if (depth == 0) if (depth == 0)
@ -349,7 +349,7 @@ namespace osu.Game.Beatmaps.Formats
private void handleVariables(string line) private void handleVariables(string line)
{ {
var pair = SplitKeyVal(line, '='); var pair = SplitKeyVal(line, '=', false);
variables[pair.Key] = pair.Value; variables[pair.Key] = pair.Value;
} }