Add Console

不知道写了什么
This commit is contained in:
2025-02-04 15:05:05 +08:00
parent bc1c5d65ef
commit b5bfa877da
5 changed files with 912 additions and 5 deletions

View File

@@ -3,29 +3,67 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DynamicExpresso;
using UnityEngine.UI;
using Dreamteck;
using System.Text.RegularExpressions;
//目前为止我还不知道我在做什么但是等我搞懂DynamicExpresso可能就会好一点 ——神币
namespace Ichni.Editor
{
public partial class EditorConsole : MonoBehaviour
{
public Interpreter functionInterpreter;
public Interpreter functionInterpreter;
public InputField InputCommand;
public GameObject ConsoleUI;
public void GetCommand()//当提交命令时
{
string[] Command =InputCommand.text.Split(" ");
switch(Command[0]){
case "help":
print("帮助菜单");
break;
case "batgenerate":
//
GameObject Prefab=new();
//
BatchGenerate(Prefab,Command[2],int.Parse(Command[3]),Command[4]);
break;
default:
print("No command match!");
break;
}
InputCommand.text="";
}
private void Start()
{
SetUpFunctions();
//Test
//functionInterpreter.Eval("Log(\"Hello World!\")");
functionInterpreter.Eval("Log(\"Hello World!\")");
}
}
public partial class EditorConsole
{
private void SetUpFunctions()
{
functionInterpreter = new Interpreter();
functionInterpreter.SetFunction("Log", (System.Action<object>)Debug.Log);
}
private void BatchGenerate(GameObject objet,string prop,int loop,string expression){//
//TODO: 预制件,属性,循环数,表达式
print("在做了");
}
}
}