我死去
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user