@@ -454,5 +454,52 @@ namespace Ichni.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
// 导出Track下所有Note为正则格式文本
|
||||
public static void ExportNotesFromTrack()
|
||||
{
|
||||
if (inspector.connectedGameElement == null || inspector.connectedGameElement.GetType() != typeof(Track))
|
||||
{
|
||||
LogWindow.Log("Please select a Track first!");
|
||||
return;
|
||||
}
|
||||
Track track = (Track)inspector.connectedGameElement;
|
||||
var notes = track.childElementList.OfType<NoteBase>().OrderBy(n => n.exactJudgeTime).ToList();
|
||||
List<string> lines = new List<string>();
|
||||
foreach (var note in notes)
|
||||
{
|
||||
string type = note switch
|
||||
{
|
||||
Tap => "Tap",
|
||||
Stay => "Stay",
|
||||
Hold => "Hold",
|
||||
Flick => "Flick",
|
||||
_ => "Unknown"
|
||||
};
|
||||
string id = track.elementName;
|
||||
float time = note.exactJudgeTime;
|
||||
float x = 0f;
|
||||
// 获取X值
|
||||
if (note.noteVisual.submoduleList.FirstOrDefault(i => i is TransformSubmodule) is TransformSubmodule ts)
|
||||
{
|
||||
x = ts.originalPosition.x;
|
||||
}
|
||||
if (note is Hold hold)
|
||||
{
|
||||
float duration = hold.holdEndTime - hold.exactJudgeTime;
|
||||
lines.Add($"({type}, {id}, {time:0.###}, {x:0.###}, {duration:0.###})");
|
||||
}
|
||||
else
|
||||
{
|
||||
lines.Add($"({type}, {id}, {time:0.###}, {x:0.###})");
|
||||
}
|
||||
}
|
||||
string result = string.Join("\n", lines);
|
||||
Debug.Log(result);
|
||||
//LogWindow.Log(result, Color.green);
|
||||
// 复制到剪贴板
|
||||
GUIUtility.systemCopyBuffer = result;
|
||||
LogWindow.Log("Colped Done!", Color.green);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user