-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2165 from andy840119/rename-property-in-the-time-tag
Rename from "romaji" into "romanization" in the time-tag.
- Loading branch information
Showing
26 changed files
with
225 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
...Game.Rulesets.Karaoke.Tests/Editor/Generator/Lyrics/Romajis/RomajiGenerateResultHelper.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ts.Karaoke.Tests/Editor/Generator/Lyrics/Romanization/RomanizationGenerateResultHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics.Romanization; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Lyrics.Romanization; | ||
|
||
public class RomanizationGenerateResultHelper | ||
{ | ||
/// <summary> | ||
/// Convert the string format into the <see cref="RomanizationGenerateResult"/>. | ||
/// </summary> | ||
/// <example> | ||
/// karaoke | ||
/// ^karaoke | ||
/// </example> | ||
/// <param name="timeTag">Origin time-tag</param> | ||
/// <param name="str">Generate result string format</param> | ||
/// <returns><see cref="RomanizationGenerateResult"/>Romanization generate result.</returns> | ||
public static KeyValuePair<TimeTag, RomanizationGenerateResult> ParseRomanizationGenerateResult(TimeTag timeTag, string str) | ||
{ | ||
var result = new RomanizationGenerateResult | ||
{ | ||
FirstSyllable = str.StartsWith("^", StringComparison.Ordinal), | ||
RomanizedSyllable = str.Replace("^", ""), | ||
}; | ||
|
||
return new KeyValuePair<TimeTag, RomanizationGenerateResult>(timeTag, result); | ||
} | ||
|
||
public static IReadOnlyDictionary<TimeTag, RomanizationGenerateResult> ParseRomanizationGenerateResults(IList<TimeTag> timeTags, IList<string> strings) | ||
{ | ||
if (timeTags.Count != strings.Count) | ||
throw new InvalidOperationException(); | ||
|
||
return parseRomanizationGenerateResults(timeTags, strings).ToDictionary(k => k.Key, v => v.Value); | ||
|
||
static IEnumerable<KeyValuePair<TimeTag, RomanizationGenerateResult>> parseRomanizationGenerateResults(IList<TimeTag> timeTags, IList<string> strings) | ||
{ | ||
for (int i = 0; i < timeTags.Count; i++) | ||
{ | ||
yield return ParseRomanizationGenerateResult(timeTags[i], strings[i]); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.