diff --git a/GFramework.Core.Godot/component/AbstractDragDrop2DComponentBase.cs b/GFramework.Core.Godot/component/AbstractDragDrop2DComponentBase.cs index 1a932d4..f85b6a7 100644 --- a/GFramework.Core.Godot/component/AbstractDragDrop2DComponentBase.cs +++ b/GFramework.Core.Godot/component/AbstractDragDrop2DComponentBase.cs @@ -11,13 +11,13 @@ namespace GFramework.Core.Godot.component; /// 继承自Godot的Node类并实现了IController接口。 /// 提供了拖拽相关的信号定义以及基础属性配置。 /// -public abstract partial class AbstractDragDrop2DComponentBase: Node, IController +public abstract partial class AbstractDragDrop2DComponentBase : Node, IController { /// /// 取消注册列表,用于管理需要在节点销毁时取消注册的对象 /// protected readonly IUnRegisterList UnRegisterList = new UnRegisterList(); - + /// /// 当拖拽被取消时触发的信号。 /// @@ -37,7 +37,7 @@ public abstract partial class AbstractDragDrop2DComponentBase: Node, IController /// 拖拽起始位置。 [Signal] public delegate void DroppedEventHandler(Vector2 startingPosition); - + /// /// 是否启用拖拽功能。若为 false,则忽略所有输入事件。 /// @@ -48,6 +48,16 @@ public abstract partial class AbstractDragDrop2DComponentBase: Node, IController /// public string GroupName { get; set; } = "dragging"; + /// + /// 获取或设置取消拖拽输入操作的名称 + /// + public string CancelDragInputActionName { get; set; } = "cancel_drag"; + + /// + /// 获取或设置选择输入操作的名称 + /// + public string SelectInputActionName { get; set; } = "select"; + /// /// 拖拽时元素的最大Z轴索引值。 /// @@ -63,12 +73,12 @@ public abstract partial class AbstractDragDrop2DComponentBase: Node, IController /// /// 返回实现IArchitecture接口的架构实例。 public abstract IArchitecture GetArchitecture(); - + /// /// 表示是否正在拖拽操作的标志位。 /// protected bool IsDragging; - + /// /// 表示拖拽操作中的偏移量,用于计算当前位置与起始位置的差值。 /// @@ -78,7 +88,7 @@ public abstract partial class AbstractDragDrop2DComponentBase: Node, IController /// 表示拖拽操作的起始位置坐标。 /// protected Vector2 StartingPosition; - + /// /// 节点退出场景树时的回调方法。 /// 在节点从场景树移除前调用,用于清理资源。 @@ -87,4 +97,4 @@ public abstract partial class AbstractDragDrop2DComponentBase: Node, IController { UnRegisterList.UnRegisterAll(); } -} +} \ No newline at end of file diff --git a/GFramework.Core.Godot/component/AbstractDragDropArea2DComponent.cs b/GFramework.Core.Godot/component/AbstractDragDropArea2DComponent.cs index 3e52bbf..f83d488 100644 --- a/GFramework.Core.Godot/component/AbstractDragDropArea2DComponent.cs +++ b/GFramework.Core.Godot/component/AbstractDragDropArea2DComponent.cs @@ -34,12 +34,12 @@ public abstract partial class AbstractDragDropArea2DComponent : AbstractDragDrop switch (IsDragging) { // 处理取消拖拽操作:当正在拖拽且按下取消拖拽按键时,执行取消拖拽逻辑 - case true when Target.IsValidNode() && @event.IsActionPressed("cancel_drag"): + case true when Target.IsValidNode() && @event.IsActionPressed(CancelDragInputActionName): CancelDragging(); // 设置输入为处理,防止输入穿透 this.SetInputAsHandled(); break; - case true when @event.IsActionReleased("select"): + case true when @event.IsActionReleased(SelectInputActionName): Drop(); break; } @@ -65,7 +65,7 @@ public abstract partial class AbstractDragDropArea2DComponent : AbstractDragDrop // 如果当前没有拖拽操作且已有其他对象正在拖拽,则直接返回 draggingObj is not null: return; - case false when @event.IsActionPressed("select"): + case false when @event.IsActionPressed(SelectInputActionName): StartDragging(); break; } diff --git a/GFramework.Core/architecture/Architecture.cs b/GFramework.Core/architecture/Architecture.cs index 2abab1a..2d06bd4 100644 --- a/GFramework.Core/architecture/Architecture.cs +++ b/GFramework.Core/architecture/Architecture.cs @@ -81,19 +81,13 @@ public abstract class Architecture : IArchitecture where T : Architecture, /// public static Action OnRegisterPatch { get; set; } = _ => { }; - /// - /// 获取架构实例的受保护静态属性 - /// 通过Lazy初始化确保只创建一个实例 - /// - /// T类型的架构实例 - protected static T MArchitecture => MArchitectureLazy.Value; /// - /// 获取架构实例的公共静态属性,以接口形式暴露 - /// 提供对外访问架构功能的标准接口 + /// 获取架构实例的静态属性 /// - /// IArchitecture接口类型的架构实例 - public static IArchitecture Interface => MArchitectureLazy.Value; + /// 返回IArchitecture类型的架构实例 + public static IArchitecture Instance => MArchitectureLazy.Value; + /// /// 注册一个系统到架构中。