GFramework/GFramework.Game/input/IInputTranslator.cs
GwWuYou 4bd9853ec1 feat(input): 引入输入转换器接口及实现
新增 `IInputTranslator` 接口用于解耦原始输入与游戏事件的转换逻辑。
在 `InputSystem` 中增加注册、注销和处理原始输入的方法,支持优先级控制。
重构 `GodotInputBridge`,移除原有硬编码翻译逻辑,改为通过 `HandleRaw` 调用转换器处理。
新增 `GodotInputTranslator` 实现 `IInputTranslator`,负责将 Godot 输入事件翻译为游戏事件。
模块初始化时自动注册该转换器至输入系统。
2025-12-21 16:34:20 +08:00

16 lines
542 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace GFramework.Game.input;
/// <summary>
/// 输入转换器接口
/// </summary>
public interface IInputTranslator
{
/// <summary>
/// 尝试将引擎输入翻译为游戏输入
/// </summary>
/// <param name="rawInput">原始的引擎输入对象</param>
/// <param name="gameEvent">输出参数,如果翻译成功则包含对应的游戏输入事件</param>
/// <returns>如果翻译成功返回true否则返回false</returns>
bool TryTranslate(object rawInput, out IGameInputEvent gameEvent);
}