2025-01-29 23:49:18 -05:00
|
|
|
|
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可能就会好一点 ——神币
|
2025-01-29 23:49:18 -05:00
|
|
|
|
namespace Ichni.Editor
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class EditorConsole : MonoBehaviour
|
|
|
|
|
|
{
|
2025-02-04 15:05:05 +08:00
|
|
|
|
|
2025-01-29 23:49:18 -05: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-01-29 23:49:18 -05:00
|
|
|
|
|
2025-02-04 15:05:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-29 23:49:18 -05:00
|
|
|
|
private void Start()
|
|
|
|
|
|
{
|
2025-02-04 15:05:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-01-29 23:49:18 -05:00
|
|
|
|
SetUpFunctions();
|
|
|
|
|
|
|
|
|
|
|
|
//Test
|
2025-02-04 15:05:05 +08:00
|
|
|
|
functionInterpreter.Eval("Log(\"Hello World!\")");
|
2025-01-29 23:49:18 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class EditorConsole
|
|
|
|
|
|
{
|
2025-02-04 15:05:05 +08:00
|
|
|
|
|
2025-01-29 23:49:18 -05: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("在做了");
|
|
|
|
|
|
}
|
2025-01-29 23:49:18 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|