Files
ichni_Creator_Studio/Assets/Scripts/Console/EditorConsole.cs

69 lines
1.9 KiB
C#
Raw Normal View History

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DynamicExpresso;
2025-02-04 15:05:05 +08:00
using UnityEngine.UI;
using Dreamteck;
using System.Text.RegularExpressions;
//目前为止我还不知道我在做什么但是等我搞懂DynamicExpresso可能就会好一点 ——神币
namespace Ichni.Editor
{
public partial class EditorConsole : MonoBehaviour
{
2025-02-04 15:05:05 +08:00
public Interpreter functionInterpreter;
2025-02-04 15:05:05 +08:00
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="";
2025-02-04 15:05:05 +08:00
}
private void Start()
{
2025-02-04 15:05:05 +08:00
SetUpFunctions();
//Test
2025-02-04 15:05:05 +08:00
functionInterpreter.Eval("Log(\"Hello World!\")");
}
}
public partial class EditorConsole
{
2025-02-04 15:05:05 +08:00
private void SetUpFunctions()
{
functionInterpreter = new Interpreter();
functionInterpreter.SetFunction("Log", (System.Action<object>)Debug.Log);
}
2025-02-04 15:05:05 +08:00
private void BatchGenerate(GameObject objet,string prop,int loop,string expression){//
//TODO: 预制件,属性,循环数,表达式
print("在做了");
}
}
}