mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-24 12:33:30 +08:00
- 新增架构层支持,包括AbstractArchitecture和ArchitectureAnchorNode - 实现拖拽功能组件AbstractDragDrop2DComponentBase和AbstractDragDropArea2DComponent - 添加节点扩展方法类NodeExtensions,提供多种实用的节点操作方法 - 新增资源目录系统AbstractAssetCatalogSystem用于管理游戏资源 - 实现音频管理系统AbstractAudioManagerSystem支持背景音乐和音效播放 - 添加取消注册扩展方法UnRegisterExtension - 创建GFramework.Game项目模块 - 重构项目结构,聚合核心模块并优化依赖引用 - [no tag]
33 lines
857 B
C#
33 lines
857 B
C#
using Godot;
|
||
|
||
namespace GFramework.Godot.architecture;
|
||
|
||
/// <summary>
|
||
/// 架构锚点节点类,用于在Godot场景树中作为架构组件的根节点
|
||
/// 该类提供了退出时的回调绑定功能,可以在节点从场景树中移除时执行清理操作
|
||
/// </summary>
|
||
public partial class ArchitectureAnchorNode : Node
|
||
{
|
||
private Action? _onExit;
|
||
|
||
/// <summary>
|
||
/// 绑定节点退出时的回调动作
|
||
/// </summary>
|
||
/// <param name="onExit">当节点从场景树退出时要执行的动作</param>
|
||
public void Bind(Action onExit)
|
||
{
|
||
_onExit = onExit;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 当节点从场景树中移除时调用此方法
|
||
/// 执行绑定的退出回调并清理引用
|
||
/// </summary>
|
||
public override void _ExitTree()
|
||
{
|
||
_onExit?.Invoke();
|
||
_onExit = null;
|
||
}
|
||
}
|
||
|