GFramework/GFramework.Game/Input/InputDeviceTracker.cs
gewuyou ebbef321ad feat(input): 新增统一输入抽象与Godot集成
- 新增输入绑定 DTO、设备上下文和 UI 语义桥接契约。

- 实现 Game 默认输入绑定存储、动作映射和 UI 分发桥接。

- 落地 Godot InputMap 适配、测试覆盖与配套文档。

- 更新 ai-plan 恢复点、worktree 映射与采用入口。
2026-05-10 22:29:26 +08:00

33 lines
921 B
C#

// Copyright (c) 2025-2026 GeWuYou
// SPDX-License-Identifier: Apache-2.0
using GFramework.Game.Abstractions.Input;
namespace GFramework.Game.Input;
/// <summary>
/// 提供可由宿主侧更新的默认输入设备跟踪器。
/// </summary>
public sealed class InputDeviceTracker : IInputDeviceTracker
{
/// <summary>
/// 初始化输入设备跟踪器。
/// </summary>
public InputDeviceTracker()
{
CurrentDevice = new InputDeviceContext(InputDeviceKind.Unknown);
}
/// <inheritdoc />
public InputDeviceContext CurrentDevice { get; private set; }
/// <summary>
/// 使用新的宿主设备上下文覆盖当前状态。
/// </summary>
/// <param name="context">新的设备上下文。</param>
public void Update(InputDeviceContext context)
{
CurrentDevice = context ?? throw new ArgumentNullException(nameof(context));
}
}