// Copyright (c) 2025-2026 GeWuYou
// SPDX-License-Identifier: Apache-2.0
namespace GFramework.Game.Abstractions.Input;
///
/// 描述一个框架无关的动作绑定。
///
///
/// 该模型是运行时输入系统与宿主适配层之间的稳定交换格式。
/// 宿主层负责把原生输入事件转成此描述,抽象层和默认运行时只根据这些字段做查询、冲突检测和持久化。
///
public sealed class InputBindingDescriptor
{
///
/// 初始化一个动作绑定描述。
///
/// 设备族。
/// 绑定类型。
/// 宿主无关的物理码值。
/// 用于设置界面展示的名称。
/// 轴向方向;非轴向绑定时为 。
/// 当 为空时抛出。
public InputBindingDescriptor(
InputDeviceKind deviceKind,
InputBindingKind bindingKind,
string code,
string displayName,
float? axisDirection = null)
{
if (string.IsNullOrWhiteSpace(code))
{
throw new ArgumentException("Binding code cannot be null or whitespace.", nameof(code));
}
DeviceKind = deviceKind;
BindingKind = bindingKind;
Code = code;
DisplayName = displayName ?? string.Empty;
AxisDirection = axisDirection;
}
///
/// 获取设备族。
///
public InputDeviceKind DeviceKind { get; }
///
/// 获取绑定类型。
///
public InputBindingKind BindingKind { get; }
///
/// 获取宿主无关的物理码值。
///
public string Code { get; }
///
/// 获取用于展示的标签。
///
public string DisplayName { get; }
///
/// 获取轴向方向。
///
public float? AxisDirection { get; }
}