我死去

This commit is contained in:
2025-11-30 15:13:57 +08:00
parent bcd2c82142
commit d0d373a948
38 changed files with 243029 additions and 16615 deletions

View File

@@ -11,6 +11,7 @@ using System.Linq.Expressions;
using Sirenix.Utilities;
using System.Collections;
using DG.Tweening;
using Unity.VisualScripting;
//又在写大粪 ——神币
namespace Ichni.Editor
@@ -53,9 +54,10 @@ namespace Ichni.Editor
Where(m => m.IsStatic && m.IsPublic && m.ReturnType == typeof(void)).
ToList();
cueText.text = "";
foreach (MethodInfo method in Allmethods)
for (int i = 0; i < Allmethods.Count; i++)
{
cueText.text += FillCueCommand(method);
MethodInfo method = Allmethods[i];
cueText.text += $"{i}: | " + FillCueCommand(method);
}
return;
}
@@ -81,9 +83,10 @@ namespace Ichni.Editor
List<MethodInfo> methods = typeof(EditorConsoleMethods).GetMethods()
.Where(m => m.IsStatic && m.IsPublic && m.ReturnType == typeof(void) && m.Name.Contains(funcName)).ToList();
cueText.text = "";
foreach (MethodInfo method in methods)
for (int i = 0; i < methods.Count; i++)
{
cueText.text += FillCueCommand(method);
MethodInfo method = methods[i];
cueText.text += $"{i}: | " + FillCueCommand(method);
}
if (cueText.text.IsNullOrWhitespace())
{
@@ -183,6 +186,30 @@ namespace Ichni.Editor
historycount++;
InputCommand.text = "";
}
CheckCtrlNumberShortcut();
}
// 支持Ctrl+数字键自动填充cueText内方法名到输入框
private void CheckCtrlNumberShortcut()
{
for (int i = 1; i <= 9; i++)
{
var key = (Key)((int)Key.Digit1 + i - 1);
if (Keyboard.current.ctrlKey.isPressed && Keyboard.current[key].wasPressedThisFrame)
{
var lines = cueText.text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
if (lines.Length >= i)
{
var line = lines[i - 1];
var match = Regex.Match(line, @"\|\s*(\w+)");
if (match.Success)
{
InputCommand.text = match.Groups[1].Value;
InputCommand.ActivateInputField();
}
}
}
}
}
private string TransformCommand(string input)
{

View File

@@ -789,5 +789,115 @@ namespace Ichni.Editor
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
#endif
}
public static void AddTagMatcher(string name, string parameterName)
{
var tagManager = EditorManager.instance.projectInformation.tagManager;
IBaseElement element = inspector.connectedGameElement;
tagManager.AddTagMatcher(name, element.GetType(), parameterName);
}
public static void FindParameterName(float value)
{
var element = inspector.connectedGameElement;
foreach (var i in element.GetType().GetFields())
{
if (i.FieldType == typeof(float) && (float)i.GetValue(element) == value)//获取对应变量的值)
{
Debug.Log($"Found parameter: {i.Name}");
LogWindow.Log($"Found parameter: {i.Name}", Color.green);
}
}
}
public static void FindParameterName(Vector3 value)
{
var element = inspector.connectedGameElement;
foreach (var field in element.GetType().GetFields())
{
if (field.FieldType == typeof(Vector3))
{
Vector3 fieldValue = (Vector3)field.GetValue(element);
if (Vector3.Distance(fieldValue, value) < 0.001f) // 使用容差比较Vector3
{
Debug.Log($"Found Vector3 parameter: {field.Name}");
LogWindow.Log($"Found Vector3 parameter: {field.Name}", Color.green);
}
}
}
}
public static void FindParameterName(Vector2 value)
{
var element = inspector.connectedGameElement;
foreach (var field in element.GetType().GetFields())
{
if (field.FieldType == typeof(Vector2))
{
Vector2 fieldValue = (Vector2)field.GetValue(element);
if (Vector2.Distance(fieldValue, value) < 0.001f) // 使用容差比较Vector2
{
Debug.Log($"Found Vector2 parameter: {field.Name}");
LogWindow.Log($"Found Vector2 parameter: {field.Name}", Color.green);
}
}
}
}
public static void FindParameterName(Color value)
{
var element = inspector.connectedGameElement;
foreach (var field in element.GetType().GetFields())
{
if (field.FieldType == typeof(Color))
{
Color fieldValue = (Color)field.GetValue(element);
if (fieldValue == value) // Color可以直接比较
{
Debug.Log($"Found Color parameter: {field.Name}");
LogWindow.Log($"Found Color parameter: {field.Name}", Color.green);
}
}
}
}
public static void FindParameterName(int value)
{
var element = inspector.connectedGameElement;
foreach (var field in element.GetType().GetFields())
{
if (field.FieldType == typeof(int))
{
int fieldValue = (int)field.GetValue(element);
if (fieldValue == value) // int可以直接比较
{
Debug.Log($"Found int parameter: {field.Name}");
LogWindow.Log($"Found int parameter: {field.Name}", Color.green);
}
}
}
}
public static void FindParameterName(string value)
{
var element = inspector.connectedGameElement;
foreach (var field in element.GetType().GetFields())
{
if (field.FieldType == typeof(string))
{
string fieldValue = (string)field.GetValue(element);
if (fieldValue == value) // string可以直接比较
{
Debug.Log($"Found string parameter: {field.Name}");
LogWindow.Log($"Found string parameter: {field.Name}", Color.green);
}
}
}
}
public static void SyncTagedElement()
{
var q = inspector.connectedGameElement;
var tagManager = EditorManager.instance.projectInformation.tagManager;
tagManager.SyncTagedElement((q));
}
}
}