1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Updated comments, renamed method

This commit is contained in:
ratinfx 2023-11-12 15:09:15 +01:00
parent 4e7c40f1d7
commit fab6fc9adb
4 changed files with 8 additions and 4 deletions

View File

@ -49,6 +49,7 @@ namespace osu.Game.Rulesets.Mania.Edit
new HoldNoteCompositionTool()
};
// 123|0,456|1,789|2 ...
private static readonly Regex selection_regex = new Regex(@"^\d+\|\d+(,\d+\|\d+)*$");
public override string ConvertSelectionToString()

View File

@ -104,6 +104,7 @@ namespace osu.Game.Rulesets.Osu.Edit
protected override ComposeBlueprintContainer CreateBlueprintContainer()
=> new OsuBlueprintContainer(this);
// 1,2,3,4 ...
private static readonly Regex selection_regex = new Regex(@"^\d+(,\d+)*$");
public override string ConvertSelectionToString()

View File

@ -434,7 +434,7 @@ namespace osu.Game
break;
case LinkAction.OpenEditorTimestamp:
SeekToTimestamp(argString);
HandleTimestamp(argString);
break;
case LinkAction.JoinMultiplayerMatch:
@ -558,7 +558,7 @@ namespace osu.Game
/// Seek to a given timestamp in the Editor and select relevant HitObjects if needed
/// </summary>
/// <param name="timestamp">The timestamp and the selected objects</param>
public void SeekToTimestamp(string timestamp)
public void HandleTimestamp(string timestamp)
{
if (ScreenStack.CurrentScreen is not Editor editor)
{

View File

@ -10,16 +10,18 @@ namespace osu.Game.Rulesets.Edit
{
public static class EditorTimestampParser
{
// 00:00:000 (1,2,3) - test
// osu-web regex: https://github.com/ppy/osu-web/blob/3b1698639244cfdaf0b41c68bfd651ea729ec2e3/resources/js/utils/beatmapset-discussion-helper.ts#L78
// 00:00:000 (...) - test
// original osu-web regex: https://github.com/ppy/osu-web/blob/3b1698639244cfdaf0b41c68bfd651ea729ec2e3/resources/js/utils/beatmapset-discussion-helper.ts#L78
public static readonly Regex TIME_REGEX = new Regex(@"\b(((\d{2,}):([0-5]\d)[:.](\d{3}))(\s\([^)]+\))?)");
public static string[] GetRegexGroups(string timestamp)
{
Match match = TIME_REGEX.Match(timestamp);
string[] result = match.Success
? match.Groups.Values.Where(x => x is not Match && !x.Value.Contains(':')).Select(x => x.Value).ToArray()
: Array.Empty<string>();
return result;
}