Console Update
This commit is contained in:
@@ -16,6 +16,8 @@ using Sirenix.Utilities;
|
||||
using UnityEngine.InputSystem;
|
||||
using TMPro;
|
||||
using MoreMountains.Tools;
|
||||
using System.Reflection;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
//又在写大粪 ——神币
|
||||
namespace Ichni.Editor
|
||||
@@ -140,9 +142,6 @@ namespace Ichni.Editor
|
||||
|
||||
private void Start()
|
||||
{
|
||||
inspector = EditorManager.instance.uiManager.inspector;
|
||||
hierarchy = EditorManager.instance.uiManager.hierarchy;
|
||||
logWindow = EditorManager.instance.uiManager.mainPage.logWindow;
|
||||
|
||||
SetUpFunctions();
|
||||
|
||||
@@ -154,25 +153,43 @@ namespace Ichni.Editor
|
||||
|
||||
public partial class EditorConsole
|
||||
{
|
||||
public Inspector inspector;
|
||||
public Hierarchy hierarchy;
|
||||
public LogWindow logWindow;
|
||||
public Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
public Hierarchy hierarchy => EditorManager.instance.uiManager.hierarchy;
|
||||
public LogWindow logWindow => EditorManager.instance.uiManager.mainPage.logWindow;
|
||||
|
||||
private void SetUpFunctions()
|
||||
public List<string> commandList = new List<string>();
|
||||
public void SetUpFunctions()
|
||||
{
|
||||
functionInterpreter = new Interpreter();
|
||||
functionInterpreter.SetFunction("test", (Action)Test);
|
||||
functionInterpreter = new Interpreter();//这是AI给的东西?
|
||||
foreach (MethodInfo i in typeof(EditorConsoleMethods).GetMethods().
|
||||
ToList().Where(i => i.IsStatic && i.IsPublic && i.ReturnType == typeof(void)))
|
||||
{
|
||||
var parameters = i.GetParameters().Select(p => p.ParameterType).ToArray();
|
||||
var delegateType = Expression.GetDelegateType(parameters.Concat(new[] { i.ReturnType }).ToArray());
|
||||
functionInterpreter.SetFunction(i.Name, i.CreateDelegate(delegateType));
|
||||
commandList.Add(i.Name);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// 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);
|
||||
|
||||
}
|
||||
|
||||
private void Kill()
|
||||
|
||||
}
|
||||
public static class EditorConsoleMethods
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -187,13 +204,13 @@ namespace Ichni.Editor
|
||||
inspector.connectedGameElement.childElementList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
private void Test()
|
||||
public static void test()
|
||||
{
|
||||
|
||||
var f0 = ElementFolder.GenerateElement("Folder", Guid.NewGuid(), new List<string>(), true, null);
|
||||
}
|
||||
|
||||
private void Tp(float x, float y, float z)
|
||||
public static void tp(float x, float y, float z)
|
||||
{
|
||||
if (EditorManager.instance.cameraManager.isSceneCameraActive)
|
||||
{
|
||||
@@ -201,7 +218,7 @@ namespace Ichni.Editor
|
||||
new Vector3(x, y, z);
|
||||
}
|
||||
}
|
||||
private void Tp()
|
||||
public static void tp()
|
||||
{
|
||||
if (EditorManager.instance.cameraManager.isSceneCameraActive)
|
||||
{
|
||||
@@ -213,7 +230,7 @@ namespace Ichni.Editor
|
||||
|
||||
|
||||
|
||||
private void LGenPathNodes(int loop, float xs, float xe, float ys, float ye, float zs, float ze)
|
||||
public static void lgp(int loop, float xs, float xe, float ys, float ye, float zs, float ze)
|
||||
{
|
||||
if (inspector.connectedGameElement == null || inspector.connectedGameElement.GetType() != typeof(Track))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user