feat(input): 添加 IInputIconService 接口及 InputDeviceType 枚举以支持按键图标管理
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BaseGames.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 按键图标服务接口。
|
||||
/// 根据当前输入设备和玩家实际绑定(含改键),返回对应的按键 Sprite。
|
||||
/// 通过 ServiceLocator 注册/查找,与 UI 层完全解耦。
|
||||
/// </summary>
|
||||
public interface IInputIconService
|
||||
{
|
||||
/// <summary>当前活跃输入设备类型。</summary>
|
||||
InputDeviceType CurrentDevice { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询指定 Action(如 "Interact")在当前设备上的按键图标。
|
||||
/// 若找不到图标(资源未配置)返回 null。
|
||||
/// </summary>
|
||||
Sprite GetActionIcon(string actionName);
|
||||
|
||||
/// <summary>
|
||||
/// 查询指定 Action 在当前设备上的有效绑定路径(含改键后的路径)。
|
||||
/// 例如:"<Keyboard>/e"、"<Gamepad>/buttonSouth"。
|
||||
/// </summary>
|
||||
string GetActionEffectivePath(string actionName);
|
||||
|
||||
/// <summary>
|
||||
/// 根据固定绑定路径(如 "<Keyboard>/space")在当前图标集中查找图标。
|
||||
/// 不受改键影响,适合装饰性按键说明。找不到时返回 null。
|
||||
/// </summary>
|
||||
Sprite GetPathIcon(string bindingPath);
|
||||
|
||||
/// <summary>
|
||||
/// 当设备切换或玩家改键后触发。
|
||||
/// 订阅此事件的 UI 组件应在回调中刷新图标显示。
|
||||
/// </summary>
|
||||
event Action OnIconSetChanged;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5c091c06f569c24788467c1d4796e71
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace BaseGames.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前活跃输入设备的分类。
|
||||
/// 用于 InputIconService 选择正确的图标集。
|
||||
/// </summary>
|
||||
public enum InputDeviceType
|
||||
{
|
||||
KeyboardMouse,
|
||||
XboxController,
|
||||
PlayStationController, // 覆盖 PS4 / PS5 DualSense
|
||||
SwitchController // 覆盖 Joy-Con 和 Switch Pro Controller
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd8b0f4a166a4dc488a9bb3760085729
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user