69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
using System;
|
||
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 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!\")");
|
||
}
|
||
}
|
||
|
||
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("在做了");
|
||
}
|
||
}
|
||
} |