mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-12 22:03:30 +08:00
- 修复 InputBindingStore 的线程安全使用说明并消除 GodotInputBindingCodec 的重复键码计算\n- 修复 GodotInputMapBackend 在全量重置时未移除运行时新增动作的语义偏差并补回归测试\n- 更新 input-system-godot-integration 的 tracking 与 trace,补录 PR review follow-up 验证结果
5.7 KiB
5.7 KiB
Input System Godot Integration 追踪
2026-05-10
阶段:统一输入抽象与 Godot 适配首轮落地(RP-001)
- 创建长分支
feat/input-system-godot-integration,并在feat/input-system-godot-integration#346上推进独立实现与验证 - 在
GFramework.Game.Abstractions/Input/新增:InputBindingDescriptorInputActionBindingInputBindingSnapshotInputDeviceContextIInputBindingStoreIInputDeviceTrackerIUiInputActionMapIUiInputDispatcher
- 在
GFramework.Game/Input/新增:InputBindingStoreInputDeviceTrackerUiInputActionMapUiInputDispatcher
- 在
GFramework.Godot/Input/新增:GodotInputBindingCodecIGodotInputMapBackendGodotInputMapBackendGodotInputBindingStore
- 关键设计决策:
- 保留字符串动作名,直接复用
InputActions.*常量 - 抽象层只暴露 descriptor / snapshot,不暴露 Godot
InputEvent - Godot backend 改成 descriptor-based contract,避免测试直接依赖原生
InputEvent实例 SetPrimaryBinding(...)改为按完整快照回写后端,以保留冲突交换语义
- 保留字符串动作名,直接复用
- 新增测试:
GFramework.Game.Tests/Input/InputBindingStoreTests.csGFramework.Game.Tests/Input/UiInputDispatcherTests.csGFramework.Godot.Tests/Input/GodotInputBindingStoreTests.cs
- 文档更新:
- 新增
docs/zh-CN/game/input.md - 新增
docs/zh-CN/godot/input.md - 更新
docs/zh-CN/game/index.md - 更新
docs/zh-CN/godot/index.md - 更新
docs/zh-CN/tutorials/godot-integration.md - 更新
GFramework.Game.Abstractions/README.md - 更新
GFramework.Game/README.md - 更新
GFramework.Godot/README.md
- 新增
下一步
- 若继续推进输入系统,优先定义更多逻辑动作与 gameplay 输入桥接,而不是先扩到宿主品牌文案
- 若要增强 Godot 验证,单独准备真实
InputMap/InputEvent集成宿主,而不是依赖普通 VSTest process
2026-05-11
阶段:PR #346 review follow-up(RP-001)
- 核对当前分支 PR
#346的 CodeRabbit review,确认以下问题仍然适用于本地代码:InputBindingStore.GetBindings(...)读取缺失动作时会隐式创建空条目,并污染ExportSnapshot()GodotInputBindingStore.ImportSnapshot(...)只覆盖快照内动作,未清空后端残留绑定InputDeviceTracker/UiInputDispatcher/IGodotInputMapBackend的 XML 文档缺少线程或异常契约GFramework.Game.Abstractions/README.md与GFramework.Game/README.md缺少输入系统文档入口- 公开 trace 中仍包含 worktree 目录名,已改为
feat/input-system-godot-integration#346
- 本轮未跟进
InputBindingDescriptor、InputActionBinding、InputBindingSnapshot、InputDeviceContext改成record的 nitpick- 原因:这些建议偏向值语义风格统一,不是当前 PR 中已验证的行为缺陷;本轮优先收敛真实回归风险与契约缺口
- 新增回归测试:
InputBindingStoreTests.GetBindings_WhenActionMissing_Should_NotMutateSnapshotGodotInputBindingStoreTests.ImportSnapshot_WhenActionMissingFromSnapshot_Should_ClearBackendBindings
- 验证结果:
dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~InputBindingStoreTests|FullyQualifiedName~UiInputDispatcherTests"通过dotnet test GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release --filter "FullyQualifiedName~GodotInputBindingStoreTests"通过
阶段:PR #346 review 二次 follow-up(RP-001)
- 再次抓取当前分支 PR
#346的 latest-head review threads,区分已在本地修复但 GitHub 线程仍未折叠的问题与仍然有效的问题 - 确认以下 review 点已在本地代码中成立并继续处理:
InputBindingStore缺少共享可变状态的线程安全使用约束说明GodotInputBindingCodec.TryCreateBinding(...)在键盘事件分支重复计算GetKeyCode(...)GodotInputMapBackend.ResetAll()对运行时新增动作只清空事件、不移除动作本身,和默认快照替换语义不一致
- 新增回归测试:
GodotInputBindingStoreTests.ResetAll_WhenRuntimeActionIsNotInDefaults_Should_RemoveAction
- 验证结果:
dotnet test GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release --filter "FullyQualifiedName~GodotInputBindingStoreTests"通过(5/5)python3 scripts/license-header.py --check --paths GFramework.Game.Abstractions/README.md GFramework.Game.Tests/Input/InputBindingStoreTests.cs GFramework.Game/Input/InputBindingStore.cs GFramework.Game/Input/InputDeviceTracker.cs GFramework.Game/Input/UiInputDispatcher.cs GFramework.Game/README.md GFramework.Godot.Tests/Input/GodotInputBindingStoreTests.cs GFramework.Godot/Input/GodotInputBindingStore.cs GFramework.Godot/Input/GodotInputMapBackend.cs GFramework.Godot/Input/IGodotInputMapBackend.cs ai-plan/public/input-system-godot-integration/traces/input-system-godot-integration-trace.md通过dotnet build GFramework.Game/GFramework.Game.csproj -c Release -m:1 -nodeReuse:false通过(0 warning, 0 error)dotnet build GFramework.Godot/GFramework.Godot.csproj -c Release -m:1 -nodeReuse:false通过(0 warning, 0 error)git ... diff --check通过
下一步
- 如需继续消化 open review threads,可再评估值对象切换到
record的收益与兼容性 - 若需要更高置信度的宿主验证,再补真实 Godot
InputMap集成测试宿主
下一步
- 运行针对本次改动文件的 license-header 检查并补录结果
- 如需继续消化 PR review,再单独评估值对象切换到
record是否值得放进同一个 PR