This commit is contained in:
2025-06-08 12:57:49 +08:00
parent a1199aa1ee
commit 8057a1dcb9
5 changed files with 28475 additions and 16397 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -24,9 +24,41 @@ namespace Ichni.Editor
public GameObject ConsoleUI;
public TMP_Text cueText;
bool isHide = true;
private string FillCueCommand(MethodInfo method)
{
if (method == null)
{
return "";
}
string methodName = method.Name;
// 3. 获取参数信息
var parameters = method.GetParameters();
if (parameters.Length == 0)
{
return $"{methodName} " + "\n";
}
// 4. 生成参数提示
string paramHint = string.Join(" ", parameters.Select(p =>
p.IsOptional ? $"[{p.ParameterType.Name}:{p.Name}]" : $"{p.ParameterType.Name}:{p.Name}"
));
return $"{methodName} {paramHint}".Trim() + "\n";
}
public void GetChange(string change)
{
if (change == "help")
{
List<MethodInfo> Allmethods = typeof(EditorConsoleMethods).GetMethods().
Where(m => m.IsStatic && m.IsPublic && m.ReturnType == typeof(void)).
ToList();
cueText.text = "";
foreach (MethodInfo method in Allmethods)
{
cueText.text += FillCueCommand(method);
}
return;
}
// Task t = new Task(() =>
// {
// 1. 提取命令名
@@ -51,24 +83,7 @@ namespace Ichni.Editor
cueText.text = "";
foreach (MethodInfo method in methods)
{
if (method == null)
{
continue;
}
string methodName = method.Name;
// 3. 获取参数信息
var parameters = method.GetParameters();
if (parameters.Length == 0)
{
cueText.text += $"{methodName} " + "\n";
continue;
}
// 4. 生成参数提示
string paramHint = string.Join(" ", parameters.Select(p =>
p.IsOptional ? $"[{p.ParameterType.Name}:{p.Name}]" : $"{p.ParameterType.Name}:{p.Name}"
));
cueText.text += $"{methodName} {paramHint}".Trim() + "\n";
cueText.text += FillCueCommand(method);
}
if (cueText.text.IsNullOrWhitespace())
{
@@ -263,16 +278,6 @@ namespace Ichni.Editor
commandList.Add(i.Name);
}
// functionInterpreter.SetFunction("test", (Action)Test);
// functionInterpreter.SetFunction("kill", (Action)Kill);
// functionInterpreter.SetFunction("lgp", (Action<int, float, float, float, float, float, float>)LGenPathNodes);
// functionInterpreter.SetFunction("print", (Action<object>)print);
// functionInterpreter.SetFunction("log", (Action<object>)Debug.Log);
// functionInterpreter.SetFunction("tp", (Action<float, float, float>)Tp);
// functionInterpreter.SetFunction("tp", (Action)Tp);
}
@@ -282,33 +287,8 @@ namespace Ichni.Editor
public static Inspector inspector => EditorManager.instance.uiManager.inspector;
public static Hierarchy hierarchy => EditorManager.instance.uiManager.hierarchy;
public static LogWindow logWindow => EditorManager.instance.uiManager.mainPage.logWindow;
public static void kill()
{
if (inspector.connectedGameElement == null)
{
LogWindow.Log("Please select a GameElement first!");
return;
}
for (int i = inspector.connectedGameElement.childElementList.Count - 1; i <= 0; i--)
{
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(
inspector.connectedGameElement.childElementList[i]
);
inspector.connectedGameElement.childElementList.RemoveAt(i);
}
}
public static void test()
{
}
public static void test2()
{
}
public static void tttttt()
{
}
public static void tp(Vector3 pos)
{
if (EditorManager.instance.cameraManager.isSceneCameraActive)
@@ -326,7 +306,11 @@ namespace Ichni.Editor
}
}
public static void reName(string message)
{
inspector.connectedGameElement.elementName = message;
inspector.connectedGameElement.Refresh();
}
public static void lgp(int loop, Vector3 start, Vector3 end)
@@ -420,6 +404,27 @@ namespace Ichni.Editor
PathNode node = PathNode.GenerateElement("SpiralNode" + i.ToString(), Guid.NewGuid(), new List<string>(), true, track, true);
node.transformSubmodule.originalPosition = pos;
}
}
public static void delSameInParent()
{
Type type = inspector.connectedGameElement.GetType();
foreach (GameElement element in inspector.connectedGameElement.parentElement.GetAllGameElementsFromThis())
{
try
{
if (element.GetType() == type && element != inspector.connectedGameElement)
{
element.Delete();
}
}
catch (Exception)
{
}
}
}
}

View File

@@ -38,7 +38,7 @@ namespace Ichni.RhythmGame
//存档类
public BaseElement_BM matchedBM { get; set; }
public virtual int HierarchyPriority => 0;
/// <summary>
@@ -53,12 +53,12 @@ namespace Ichni.RhythmGame
this.tags = tags;
EditorManager.instance.beatmapContainer.gameElementList.Add(this);
submoduleList = new List<SubmoduleBase>();
if (isFirstGenerated)
{
SetDefaultSubmodules();
}
SetParent(parentElement);
EditorManager.instance.uiManager.hierarchy.GenerateTab(this, parentElement);
@@ -77,7 +77,7 @@ namespace Ichni.RhythmGame
public virtual void SetEditorSubmodules()
{
}
/// <summary>
@@ -101,7 +101,7 @@ namespace Ichni.RhythmGame
transform.SetParent(parentElement.transform);
}
}
public int CompareTo(GameElement other)
{
return HierarchyPriority.CompareTo(other.HierarchyPriority);
@@ -167,7 +167,7 @@ namespace Ichni.RhythmGame
{
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Element Info");
//基础信息
var info = container.GenerateSubcontainer(3);
var nameInputField = inspector.GenerateInputField(this, info, GetType().Name + "'s Name", nameof(elementName));
@@ -176,15 +176,15 @@ namespace Ichni.RhythmGame
{
inspector.GenerateCompositeParameterWindow(this, "Tags List", nameof(tags)).SetAsStringList();
});
//次级模块
foreach (var submodule in submoduleList)
{
submodule.SetUpInspector();
}
}
/// <summary>
/// 获取所有子GameElement
/// </summary>
@@ -265,8 +265,8 @@ namespace Ichni.RhythmGame
/// </summary>
/// <param name="attached">父物体</param>
public abstract GameElement DuplicateBM(GameElement attached);
public static List<BaseElement_BM> GetAllAttachedBaseElements(GameElement_BM gameElement, List<BaseElement_BM> clip)
{
Guid elementGuid = gameElement.elementGuid;

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@ Editor内有console系统用于执行某些方便的操作。
输入框配有上下文,在输入时按上下箭头可以跳转到上一次的指令。
输入格式按照 **指令 值 值 值** 的格式输入,其中值大多是数字值,如果是字符的话,需要带上双引号
输入格式按照 **func "abc123" 1 2 [0,1,2]** 的格式输入,也可以用**func(1,2,3,"a",[1,2,3])**输入,其中值大多是数字值,如果是字符的话,需要带上双引号(`"abc123"`如果是向量vector23就需要用中括号括起来(` [0,0,1] `)
如果因为某种原因而导致指令执行失败的话会在下面的log window有提醒。
@@ -15,16 +15,23 @@ Editor内有console系统用于执行某些方便的操作。
## 命令列表
(格式:命令名字 值1 值2 …值x
tp(Vector3 pos)
将场景相机移动到指定的三维坐标 pos。
- **`lgp生成数 x轴开始 x轴结束 y轴开始 y轴结束 z轴开始 z轴结束 `**
loop Generate Pathnode输入全部是数字值用于批量生成pathnode记得选中track
如:`lgp 10 0 0 0 5 0 100` 在track下生成10个pathnodey值从0到5z值从0到100
tp()
将场景相机移动到当前 Inspector 选中元素的位置
- **`tp x y z`**
将场景相机快速移动到某个地方如果不输入xyz那么会移动到所选项的位置。~~和mc里一个样~~
reName(string message)
将当前 Inspector 选中元素的名称改为 message。
- 在做了
lgp(int loop, Vector3 start, Vector3 end)
在选中的 Track 上,按线性插值方式批量生成 loop 个 PathNode起止点为 start 和 end。
spiral(int loop, Vector3 center, float r, float h, int pointsPerTurn, string axis = "y")
在选中的 Track 上按指定主轴x/y/z和参数批量生成螺旋线分布的 PathNode。
spiral(int loop, Vector3 center, float r, float h, int pointsPerTurn, Vector3 dir)
在选中的 Track 上按任意方向dir 向量)和参数,批量生成螺旋线分布的 PathNode。
## 其他