尝试优化Inspector的排版
在输数字的地方输入框的输入限制可以改成十进制数,这样就不会因为输了字母然后报错了
This commit is contained in:
@@ -14,6 +14,7 @@ using Unity.VisualScripting;
|
||||
using Ichni.RhythmGame;
|
||||
using Sirenix.Utilities;
|
||||
using UnityEngine.InputSystem;
|
||||
using TMPro;
|
||||
|
||||
//又在写大粪 ——神币
|
||||
namespace Ichni.Editor
|
||||
@@ -22,14 +23,14 @@ namespace Ichni.Editor
|
||||
{
|
||||
|
||||
public Interpreter functionInterpreter;
|
||||
public InputField InputCommand;
|
||||
public TMP_InputField InputCommand;
|
||||
private Dictionary<int,string> historyCommand=new Dictionary<int,string>();
|
||||
private int historycount=0;
|
||||
public GameObject ConsoleUI;
|
||||
|
||||
public Hierarchy hierarchy;
|
||||
public Inspector inspector;
|
||||
bool isHide=false;
|
||||
bool isHide=true;
|
||||
|
||||
public void GetChange(string change){
|
||||
|
||||
@@ -47,8 +48,8 @@ namespace Ichni.Editor
|
||||
}
|
||||
private void Update(){
|
||||
if(Keyboard.current.backquoteKey.wasPressedThisFrame){
|
||||
hierarchy.gameObject.SetActive(isHide);
|
||||
inspector.gameObject.SetActive(isHide);
|
||||
ConsoleUI.SetActive(isHide);
|
||||
|
||||
isHide=!isHide;
|
||||
}
|
||||
if(InputCommand.isFocused){
|
||||
@@ -79,26 +80,25 @@ namespace Ichni.Editor
|
||||
SetUpFunctions();
|
||||
|
||||
//Test
|
||||
functionInterpreter.Eval("print(\"Hello World!\")");
|
||||
functionInterpreter.Eval("log(\"Hello World but debug!\")");
|
||||
// functionInterpreter.Eval("print(\"Hello World!\")");
|
||||
// functionInterpreter.Eval("log(\"Hello World but debug!\")");
|
||||
}
|
||||
}
|
||||
|
||||
public partial class EditorConsole
|
||||
{
|
||||
|
||||
private delegate void Batch(string name,string prop,int loop,string expression);
|
||||
private Batch _batch;
|
||||
|
||||
|
||||
|
||||
private void SetUpFunctions()
|
||||
{
|
||||
functionInterpreter = new Interpreter();
|
||||
functionInterpreter.SetFunction("test",(Action)Test);
|
||||
functionInterpreter.SetFunction("loopg", (Action<string,int>)LoopGenerate);
|
||||
functionInterpreter.SetFunction("lgp", (Action<string,int>)LGenPathNodes);
|
||||
functionInterpreter.SetFunction("print", (Action<object>)print);
|
||||
functionInterpreter.SetFunction("log", (Action<object>)Debug.Log);
|
||||
_batch=BatchGenerate;
|
||||
functionInterpreter.SetFunction("BatchGenerate",_batch);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -121,33 +121,26 @@ namespace Ichni.Editor
|
||||
}
|
||||
}
|
||||
//TODO duotrack选择菜单
|
||||
|
||||
if(obji.IsNullOrEmpty()){
|
||||
Debug.LogWarning("no find");
|
||||
return null;}
|
||||
return obji[0];
|
||||
|
||||
}
|
||||
private void BatchGenerate(string name,string prop,int loop,string expression){//
|
||||
GameElement[] allObjects = Resources.FindObjectsOfTypeAll(typeof(GameElement)) as GameElement[];
|
||||
List<int> objs=new();
|
||||
foreach (GameElement obj in allObjects){
|
||||
if(obj.elementName==name)objs.Add(obj.GetInstanceID());
|
||||
}
|
||||
print(objs);
|
||||
//TODO: 预制件,属性,循环数,表达式
|
||||
|
||||
|
||||
print("在做了");
|
||||
|
||||
|
||||
}
|
||||
private void LoopGenerate(string name,int time){
|
||||
|
||||
private void LGenPathNodes(string name,int loop){
|
||||
|
||||
Track track= (Track)Find(name);
|
||||
|
||||
for(int i=0;i<time;i++){
|
||||
|
||||
PathNode.GenerateElement("PathNodes", Guid.NewGuid(), new List<string>(), true,track);
|
||||
for(int i=0;i<loop;i++){
|
||||
|
||||
var p=PathNode.GenerateElement("PathNodes", Guid.NewGuid(), new List<string>(), true,track);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user