更新InputGlyph编辑器

This commit is contained in:
陈思海 2026-03-19 13:59:42 +08:00
parent 7b32b87ec7
commit 843cd5e38e
4 changed files with 927 additions and 659 deletions

View File

@ -6,7 +6,6 @@ using UnityEngine.InputSystem;
/// <summary> /// <summary>
/// 输入读取工具。 /// 输入读取工具。
/// 负责运行时输入轮询、单次触发和切换态管理, /// 负责运行时输入轮询、单次触发和切换态管理,
/// 与 InputBindingManager 的绑定/重绑定职责分离。
/// </summary> /// </summary>
public static class InputActionReader public static class InputActionReader
{ {

View File

@ -72,7 +72,7 @@ public sealed class InputGlyphDatabase : ScriptableObject
} }
EnsureCache(); EnsureCache();
_tableCache.TryGetValue(deviceName.ToLowerInvariant(), out DeviceGlyphTable table); _tableCache.TryGetValue(deviceName, out DeviceGlyphTable table);
return table; return table;
} }
@ -175,6 +175,11 @@ public sealed class InputGlyphDatabase : ScriptableObject
InitializeLookup(InputDeviceWatcher.InputDeviceCategory.PlayStation); InitializeLookup(InputDeviceWatcher.InputDeviceCategory.PlayStation);
InitializeLookup(InputDeviceWatcher.InputDeviceCategory.Other); InitializeLookup(InputDeviceWatcher.InputDeviceCategory.Other);
if (tables == null)
{
return;
}
for (int i = 0; i < tables.Count; i++) for (int i = 0; i < tables.Count; i++)
{ {
DeviceGlyphTable table = tables[i]; DeviceGlyphTable table = tables[i];
@ -183,13 +188,25 @@ public sealed class InputGlyphDatabase : ScriptableObject
continue; continue;
} }
_tableCache[table.deviceName.ToLowerInvariant()] = table; _tableCache[table.deviceName] = table;
InputDeviceWatcher.InputDeviceCategory category = ParseCategory(table.deviceName); InputDeviceWatcher.InputDeviceCategory category = ParseCategory(table.deviceName);
Dictionary<string, Sprite> map = _pathLookup[category]; Dictionary<string, Sprite> map = _pathLookup[category];
RegisterEntries(table, map); RegisterEntries(table, map);
} }
} }
#if UNITY_EDITOR
public void EditorRefreshCache()
{
BuildCache();
}
public static string EditorNormalizeControlPath(string controlPath)
{
return NormalizeControlPath(controlPath);
}
#endif
private void InitializeLookup(InputDeviceWatcher.InputDeviceCategory category) private void InitializeLookup(InputDeviceWatcher.InputDeviceCategory category)
{ {
_pathLookup[category] = new Dictionary<string, Sprite>(StringComparer.OrdinalIgnoreCase); _pathLookup[category] = new Dictionary<string, Sprite>(StringComparer.OrdinalIgnoreCase);

View File

@ -14,8 +14,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_PixelRect: m_PixelRect:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 1920
y: 43 y: 48
width: 1920 width: 1920
height: 997 height: 997
m_ShowMode: 4 m_ShowMode: 4
@ -41,10 +41,10 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 566 y: 566
width: 308 width: 505
height: 381 height: 381
m_MinSize: {x: 51, y: 71} m_MinSize: {x: 50, y: 50}
m_MaxSize: {x: 4001, y: 4021} m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 14} m_ActualView: {fileID: 14}
m_Panes: m_Panes:
- {fileID: 14} - {fileID: 14}
@ -70,7 +70,7 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 308 width: 505
height: 947 height: 947
m_MinSize: {x: 100, y: 100} m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 8096, y: 16192} m_MaxSize: {x: 8096, y: 16192}
@ -174,7 +174,7 @@ MonoBehaviour:
m_MinSize: {x: 400, y: 100} m_MinSize: {x: 400, y: 100}
m_MaxSize: {x: 32384, y: 16192} m_MaxSize: {x: 32384, y: 16192}
vertical: 0 vertical: 0
controlID: 144 controlID: 104
draggingID: 0 draggingID: 0
--- !u!114 &8 --- !u!114 &8
MonoBehaviour: MonoBehaviour:
@ -193,7 +193,7 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 308 width: 505
height: 566 height: 566
m_MinSize: {x: 201, y: 221} m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021} m_MaxSize: {x: 4001, y: 4021}
@ -219,9 +219,9 @@ MonoBehaviour:
- {fileID: 11} - {fileID: 11}
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 308 x: 505
y: 0 y: 0
width: 387 width: 223
height: 947 height: 947
m_MinSize: {x: 100, y: 100} m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 8096, y: 16192} m_MaxSize: {x: 8096, y: 16192}
@ -245,10 +245,10 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 387 width: 223
height: 409 height: 409
m_MinSize: {x: 202, y: 221} m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4002, y: 4021} m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 17} m_ActualView: {fileID: 17}
m_Panes: m_Panes:
- {fileID: 17} - {fileID: 17}
@ -271,10 +271,10 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 409 y: 409
width: 387 width: 223
height: 538 height: 538
m_MinSize: {x: 102, y: 121} m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 4002, y: 4021} m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 18} m_ActualView: {fileID: 18}
m_Panes: m_Panes:
- {fileID: 18} - {fileID: 18}
@ -295,9 +295,9 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 695 x: 728
y: 0 y: 0
width: 607 width: 574
height: 947 height: 947
m_MinSize: {x: 232, y: 271} m_MinSize: {x: 232, y: 271}
m_MaxSize: {x: 10002, y: 10021} m_MaxSize: {x: 10002, y: 10021}
@ -352,9 +352,9 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 1920
y: 639 y: 644
width: 307 width: 504
height: 360 height: 360
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
@ -380,7 +380,7 @@ MonoBehaviour:
m_UseMipMap: 0 m_UseMipMap: 0
m_VSyncEnabled: 0 m_VSyncEnabled: 0
m_Gizmos: 0 m_Gizmos: 0
m_Stats: 1 m_Stats: 0
m_SelectedSizes: 03000000000000000000000000000000000000000000000000000000000000000000000000000000 m_SelectedSizes: 03000000000000000000000000000000000000000000000000000000000000000000000000000000
m_ZoomArea: m_ZoomArea:
m_HRangeLocked: 0 m_HRangeLocked: 0
@ -408,23 +408,23 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 21 y: 21
width: 307 width: 504
height: 339 height: 339
m_Scale: {x: 0.15989584, y: 0.15989585} m_Scale: {x: 0.2625, y: 0.2625}
m_Translation: {x: 153.5, y: 169.5} m_Translation: {x: 252, y: 169.5}
m_MarginLeft: 0 m_MarginLeft: 0
m_MarginRight: 0 m_MarginRight: 0
m_MarginTop: 0 m_MarginTop: 0
m_MarginBottom: 0 m_MarginBottom: 0
m_LastShownAreaInsideMargins: m_LastShownAreaInsideMargins:
serializedVersion: 2 serializedVersion: 2
x: -960 x: -960.00006
y: -1060.0651 y: -645.7143
width: 1920 width: 1920.0001
height: 2120.1301 height: 1291.4286
m_MinimalGUI: 1 m_MinimalGUI: 1
m_defaultScale: 0.15989584 m_defaultScale: 0.2625
m_LastWindowPixelSize: {x: 307, y: 360} m_LastWindowPixelSize: {x: 504, y: 360}
m_ClearInEditMode: 1 m_ClearInEditMode: 1
m_NoCameraWarning: 1 m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000 m_LowResolutionForAspectRatios: 01000000000000000000
@ -520,9 +520,9 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 1920
y: 73 y: 78
width: 307 width: 504
height: 545 height: 545
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
@ -1066,7 +1066,7 @@ MonoBehaviour:
m_Position: m_Position:
m_Target: {x: 1000, y: 1000, z: 100} m_Target: {x: 1000, y: 1000, z: 100}
speed: 2 speed: 2
m_Value: {x: 1000, y: 1000, z: 100} m_Value: {x: 0, y: 0, z: 0}
m_RenderMode: 0 m_RenderMode: 0
m_CameraMode: m_CameraMode:
drawMode: 0 drawMode: 0
@ -1104,7 +1104,7 @@ MonoBehaviour:
m_Fade: m_Fade:
m_Target: 0 m_Target: 0
speed: 2 speed: 2
m_Value: 0 m_Value: 1
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4} m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
m_Pivot: {x: 0, y: 0, z: 0} m_Pivot: {x: 0, y: 0, z: 0}
m_Size: {x: 1, y: 1} m_Size: {x: 1, y: 1}
@ -1114,11 +1114,11 @@ MonoBehaviour:
m_Rotation: m_Rotation:
m_Target: {x: -0.21037178, y: -0.10913931, z: 0.02363893, w: -0.97122556} m_Target: {x: -0.21037178, y: -0.10913931, z: 0.02363893, w: -0.97122556}
speed: 2 speed: 2
m_Value: {x: -0.2103712, y: -0.10913901, z: 0.023638865, w: -0.9712229} m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size: m_Size:
m_Target: 0.7536363 m_Target: 0.7536363
speed: 2 speed: 2
m_Value: 0.7536363 m_Value: 10
m_Ortho: m_Ortho:
m_Target: 0 m_Target: 0
speed: 2 speed: 2
@ -1163,9 +1163,9 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 308 x: 2425
y: 73 y: 78
width: 385 width: 221
height: 388 height: 388
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
@ -1180,9 +1180,9 @@ MonoBehaviour:
m_SceneHierarchy: m_SceneHierarchy:
m_TreeViewState: m_TreeViewState:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: 02200000 m_SelectedIDs:
m_LastClickedID: 0 m_LastClickedID: 0
m_ExpandedIDs: aebbfffff2d0fffffad0fffffcd0ffff26fbffff28fbffff m_ExpandedIDs: ccf9ffff
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -1226,9 +1226,9 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 308 x: 2425
y: 482 y: 487
width: 385 width: 221
height: 517 height: 517
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
@ -1260,9 +1260,9 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 695 x: 2648
y: 73 y: 78
width: 605 width: 572
height: 926 height: 926
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
@ -1285,7 +1285,7 @@ MonoBehaviour:
m_SkipHidden: 0 m_SkipHidden: 0
m_SearchArea: 2 m_SearchArea: 2
m_Folders: m_Folders:
- Assets/Scripts/Hotfix/GameLogic - Packages/com.alicizax.unity.framework
m_Globs: [] m_Globs: []
m_OriginalText: m_OriginalText:
m_ImportLogFlags: 0 m_ImportLogFlags: 0
@ -1301,7 +1301,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: e48c0000 m_SelectedIDs: e48c0000
m_LastClickedID: 36068 m_LastClickedID: 36068
m_ExpandedIDs: 000000007e0200008c0d0000246c00008a6d00008c6d00008e6d0000906d0000926d0000946d0000966d0000986d00009a6d00009c6d00009e6d0000a06d0000a26d0000a46d0000a66d0000a86d0000aa6d0000ac6d0000ae6d0000b06d0000b26d0000b46d0000b66d0000b86d0000ba6d0000bc6d0000be6d0000c06d0000c26d0000c46d0000c66d0000c86d0000ca6d0000cc6d0000ce6d0000d06d0000d26d0000d46d0000d66d0000d86d0000da6d0000dc6d0000de6d0000e06d0000e26d0000e46d0000e66d0000e86d0000ea6d0000ec6d0000ee6d0000f06d0000f26d0000f46d0000f66d0000f86d0000fa6d0000fc6d0000fe6d0000006e0000 m_ExpandedIDs: 000000007e020000020d0000ec6a0000ee6a0000f06a0000f26a0000f46a0000f66a0000f86a0000fa6a0000fc6a0000fe6a0000006b0000026b0000046b0000066b0000086b00000a6b00000c6b00000e6b0000106b0000126b0000146b0000166b0000186b00001a6b00001c6b00001e6b0000206b0000226b0000246b0000266b0000286b00002a6b00002c6b00002e6b0000306b0000326b0000346b0000366b0000386b00003a6b00003c6b00003e6b0000406b0000426b0000446b0000466b0000486b00004a6b00004c6b00004e6b0000506b0000526b0000546b0000566b0000586b00005a6b00005c6b00005e6b0000606b0000626b0000646b0000666b0000686b00006a6b00006c6b00006e6b0000706b0000726b0000746b0000766b0000786b0000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -1329,21 +1329,21 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs:
m_LastClickedID: 0 m_LastClickedID: 0
m_ExpandedIDs: ffffffff000000007e0200008c0d00008a6d00008c6d00008e6d0000906d0000926d0000966d0000986d00009a6d00009c6d00009e6d0000a06d0000a26d0000a46d0000a66d0000a86d0000aa6d0000ac6d0000ae6d0000b06d0000b26d0000b46d0000b66d0000ba6d0000bc6d0000be6d0000c06d0000c26d0000c46d0000c66d0000c86d0000ca6d0000cc6d0000ce6d0000d06d0000d26d0000d46d0000d66d0000d86d0000da6d0000e46d0000e66d0000e86d0000ea6d0000ec6d0000ee6d0000f06d0000f26d0000f66d0000f86d0000fc6d0000fe6d0000006e0000be6f0000c06f0000187000001a7000001c7000006a700000207100003c7100007a7100007c7100007e71000080710000b2710000c472000060730000267400004a750000dc75000032770000 m_ExpandedIDs: ffffffff000000007e020000020d0000ec6a0000ee6a0000f06a0000f26a0000f46a0000f66a0000f86a0000fc6a0000fe6a0000006b0000026b0000046b0000066b0000086b00000a6b00000c6b00000e6b0000106b0000126b0000146b0000166b0000186b00001a6b00001c6b00001e6b0000206b0000226b0000246b0000266b0000286b00002a6b00002c6b00002e6b0000306b0000326b0000346b0000386b00003c6b00003e6b0000406b0000426b0000446b0000466b00004a6b00004c6b0000506b0000526b0000566b00005a6b00005c6b00005e6b0000606b0000626b0000646b0000666b0000686b00006a6b00006c6b00006e6b0000706b0000726b0000746b0000766b0000786b00006c6d00006e6d0000706d0000766d0000c86d0000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name: ProcedureEntryState
m_OriginalName: m_OriginalName: ProcedureEntryState
m_EditFieldRect: m_EditFieldRect:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 0 width: 0
height: 0 height: 0
m_UserData: 0 m_UserData: 3678
m_IsWaitingForDelay: 0 m_IsWaitingForDelay: 0
m_IsRenaming: 0 m_IsRenaming: 0
m_OriginalEventType: 11 m_OriginalEventType: 0
m_IsRenamingFilename: 1 m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 12} m_ClientGUIView: {fileID: 12}
m_SearchString: m_SearchString:
@ -1405,8 +1405,8 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 1302 x: 3222
y: 73 y: 78
width: 617 width: 617
height: 926 height: 926
m_SerializedDataModeController: m_SerializedDataModeController: