From 49ecff82621c18e1521ed58d72bb6f932d5da658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Wed, 11 Mar 2026 15:04:33 +0800 Subject: [PATCH] 1 --- .../UXControllerStateRecorderEditor.cs | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/Editor/UX/Controller/UXControllerStateRecorderEditor.cs b/Editor/UX/Controller/UXControllerStateRecorderEditor.cs index 6f19c88..f847143 100644 --- a/Editor/UX/Controller/UXControllerStateRecorderEditor.cs +++ b/Editor/UX/Controller/UXControllerStateRecorderEditor.cs @@ -339,6 +339,27 @@ namespace AlicizaX.UI ? "Not Bound" : $"Bound to: {controllerNameProp.stringValue}[{controllerIndexProp.intValue}]"; EditorGUILayout.LabelField(bindingText, EditorStyles.miniLabel); + + // 在紧凑模式下也允许快速修改索引 + if (!string.IsNullOrEmpty(controllerNameProp.stringValue)) + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Index", GUILayout.Width(50)); + + int ctrlLen = GetSelectedControllerLength(recorder, controllerNameProp.stringValue); + if (ctrlLen <= 0) ctrlLen = 1; + + string[] idxOptions = new string[ctrlLen]; + for (int j = 0; j < ctrlLen; j++) idxOptions[j] = j.ToString(); + + EditorGUI.BeginChangeCheck(); + int newIdx = EditorGUILayout.Popup(controllerIndexProp.intValue, idxOptions, GUILayout.Width(60)); + if (EditorGUI.EndChangeCheck()) + { + controllerIndexProp.intValue = newIdx; + } + EditorGUILayout.EndHorizontal(); + } } catch (ObjectDisposedException) { @@ -753,10 +774,9 @@ namespace AlicizaX.UI Debug.LogException(ex); return; } - + var recorder = serializedObject.targetObject as UXControllerStateRecorder; if (instance != null) { - var recorder = serializedObject.targetObject as UXControllerStateRecorder; instance.Init(recorder); } @@ -766,8 +786,17 @@ namespace AlicizaX.UI stateProp.isExpanded = true; } - controllerNameProp.stringValue = ""; - controllerIndexProp.intValue = 0; + var controllerNames = GetControllerNamesForRecorder(recorder); + if (controllerNames.Count > 0) + { + controllerNameProp.stringValue = controllerNames[0]; + controllerIndexProp.intValue = 0; + } + else + { + controllerNameProp.stringValue = ""; + controllerIndexProp.intValue = 0; + } serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(serializedObject.targetObject);