mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
- 新增架构层支持,包括AbstractArchitecture和ArchitectureAnchorNode - 实现拖拽功能组件AbstractDragDrop2DComponentBase和AbstractDragDropArea2DComponent - 添加节点扩展方法类NodeExtensions,提供多种实用的节点操作方法 - 新增资源目录系统AbstractAssetCatalogSystem用于管理游戏资源 - 实现音频管理系统AbstractAudioManagerSystem支持背景音乐和音效播放 - 添加取消注册扩展方法UnRegisterExtension - 创建GFramework.Game项目模块 - 重构项目结构,聚合核心模块并优化依赖引用 - [no tag]
79 lines
2.0 KiB
C#
79 lines
2.0 KiB
C#
namespace GFramework.Godot.system;
|
|
|
|
/// <summary>
|
|
/// 输入动作类,表示游戏中的一种输入行为
|
|
/// </summary>
|
|
public class InputAction
|
|
{
|
|
/// <summary>
|
|
/// 动作名称
|
|
/// </summary>
|
|
public string Name { get; }
|
|
|
|
/// <summary>
|
|
/// 动作类型
|
|
/// </summary>
|
|
public InputActionType ActionType { get; }
|
|
|
|
/// <summary>
|
|
/// 默认按键绑定
|
|
/// </summary>
|
|
public string[] DefaultBindings { get; }
|
|
|
|
/// <summary>
|
|
/// 当前按键绑定
|
|
/// </summary>
|
|
public string[] CurrentBindings { get; private set; }
|
|
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
/// <param name="name">动作名称</param>
|
|
/// <param name="actionType">动作类型</param>
|
|
/// <param name="defaultBindings">默认按键绑定</param>
|
|
public InputAction(string name, InputActionType actionType, params string[] defaultBindings)
|
|
{
|
|
Name = name ?? throw new ArgumentNullException(nameof(name));
|
|
ActionType = actionType;
|
|
DefaultBindings = defaultBindings ?? throw new ArgumentNullException(nameof(defaultBindings));
|
|
CurrentBindings = (string[])defaultBindings.Clone();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 重置为默认按键绑定
|
|
/// </summary>
|
|
public void ResetToDefault()
|
|
{
|
|
CurrentBindings = (string[])DefaultBindings.Clone();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置新的按键绑定
|
|
/// </summary>
|
|
/// <param name="bindings">新的按键绑定</param>
|
|
public void SetBindings(params string[] bindings)
|
|
{
|
|
CurrentBindings = bindings ?? throw new ArgumentNullException(nameof(bindings));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 输入动作类型枚举
|
|
/// </summary>
|
|
public enum InputActionType
|
|
{
|
|
/// <summary>
|
|
/// 按钮类型,如跳跃、射击等
|
|
/// </summary>
|
|
Button,
|
|
|
|
/// <summary>
|
|
/// 轴类型,如移动、视角控制等
|
|
/// </summary>
|
|
Axis,
|
|
|
|
/// <summary>
|
|
/// 向量类型,如二维移动控制
|
|
/// </summary>
|
|
Vector
|
|
} |