整理
This commit is contained in:
@@ -24,9 +24,41 @@ namespace Ichni.Editor
|
||||
public GameObject ConsoleUI;
|
||||
public TMP_Text cueText;
|
||||
bool isHide = true;
|
||||
private string FillCueCommand(MethodInfo method)
|
||||
{
|
||||
if (method == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
string methodName = method.Name;
|
||||
// 3. 获取参数信息
|
||||
var parameters = method.GetParameters();
|
||||
if (parameters.Length == 0)
|
||||
{
|
||||
|
||||
return $"{methodName} " + "\n";
|
||||
}
|
||||
|
||||
// 4. 生成参数提示
|
||||
string paramHint = string.Join(" ", parameters.Select(p =>
|
||||
p.IsOptional ? $"[{p.ParameterType.Name}:{p.Name}]" : $"{p.ParameterType.Name}:{p.Name}"
|
||||
));
|
||||
return $"{methodName} {paramHint}".Trim() + "\n";
|
||||
}
|
||||
public void GetChange(string change)
|
||||
{
|
||||
if (change == "help")
|
||||
{
|
||||
List<MethodInfo> Allmethods = typeof(EditorConsoleMethods).GetMethods().
|
||||
Where(m => m.IsStatic && m.IsPublic && m.ReturnType == typeof(void)).
|
||||
ToList();
|
||||
cueText.text = "";
|
||||
foreach (MethodInfo method in Allmethods)
|
||||
{
|
||||
cueText.text += FillCueCommand(method);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Task t = new Task(() =>
|
||||
// {
|
||||
// 1. 提取命令名
|
||||
@@ -51,24 +83,7 @@ namespace Ichni.Editor
|
||||
cueText.text = "";
|
||||
foreach (MethodInfo method in methods)
|
||||
{
|
||||
if (method == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string methodName = method.Name;
|
||||
// 3. 获取参数信息
|
||||
var parameters = method.GetParameters();
|
||||
if (parameters.Length == 0)
|
||||
{
|
||||
cueText.text += $"{methodName} " + "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
// 4. 生成参数提示
|
||||
string paramHint = string.Join(" ", parameters.Select(p =>
|
||||
p.IsOptional ? $"[{p.ParameterType.Name}:{p.Name}]" : $"{p.ParameterType.Name}:{p.Name}"
|
||||
));
|
||||
cueText.text += $"{methodName} {paramHint}".Trim() + "\n";
|
||||
cueText.text += FillCueCommand(method);
|
||||
}
|
||||
if (cueText.text.IsNullOrWhitespace())
|
||||
{
|
||||
@@ -263,16 +278,6 @@ namespace Ichni.Editor
|
||||
commandList.Add(i.Name);
|
||||
}
|
||||
|
||||
|
||||
// functionInterpreter.SetFunction("test", (Action)Test);
|
||||
|
||||
// functionInterpreter.SetFunction("kill", (Action)Kill);
|
||||
// functionInterpreter.SetFunction("lgp", (Action<int, float, float, float, float, float, float>)LGenPathNodes);
|
||||
// functionInterpreter.SetFunction("print", (Action<object>)print);
|
||||
// functionInterpreter.SetFunction("log", (Action<object>)Debug.Log);
|
||||
// functionInterpreter.SetFunction("tp", (Action<float, float, float>)Tp);
|
||||
// functionInterpreter.SetFunction("tp", (Action)Tp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -282,33 +287,8 @@ namespace Ichni.Editor
|
||||
public static Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
public static Hierarchy hierarchy => EditorManager.instance.uiManager.hierarchy;
|
||||
public static LogWindow logWindow => EditorManager.instance.uiManager.mainPage.logWindow;
|
||||
public static void kill()
|
||||
{
|
||||
if (inspector.connectedGameElement == null)
|
||||
{
|
||||
LogWindow.Log("Please select a GameElement first!");
|
||||
return;
|
||||
}
|
||||
for (int i = inspector.connectedGameElement.childElementList.Count - 1; i <= 0; i--)
|
||||
{
|
||||
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(
|
||||
inspector.connectedGameElement.childElementList[i]
|
||||
);
|
||||
inspector.connectedGameElement.childElementList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
public static void test()
|
||||
{
|
||||
|
||||
}
|
||||
public static void test2()
|
||||
{
|
||||
|
||||
}
|
||||
public static void tttttt()
|
||||
{
|
||||
|
||||
}
|
||||
public static void tp(Vector3 pos)
|
||||
{
|
||||
if (EditorManager.instance.cameraManager.isSceneCameraActive)
|
||||
@@ -326,7 +306,11 @@ namespace Ichni.Editor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void reName(string message)
|
||||
{
|
||||
inspector.connectedGameElement.elementName = message;
|
||||
inspector.connectedGameElement.Refresh();
|
||||
}
|
||||
|
||||
|
||||
public static void lgp(int loop, Vector3 start, Vector3 end)
|
||||
@@ -420,6 +404,27 @@ namespace Ichni.Editor
|
||||
|
||||
PathNode node = PathNode.GenerateElement("SpiralNode" + i.ToString(), Guid.NewGuid(), new List<string>(), true, track, true);
|
||||
node.transformSubmodule.originalPosition = pos;
|
||||
}
|
||||
}
|
||||
public static void delSameInParent()
|
||||
{
|
||||
Type type = inspector.connectedGameElement.GetType();
|
||||
foreach (GameElement element in inspector.connectedGameElement.parentElement.GetAllGameElementsFromThis())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (element.GetType() == type && element != inspector.connectedGameElement)
|
||||
{
|
||||
element.Delete();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user