mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-24 04:06:48 +08:00
- 新增架构层支持,包括AbstractArchitecture和ArchitectureAnchorNode - 实现拖拽功能组件AbstractDragDrop2DComponentBase和AbstractDragDropArea2DComponent - 添加节点扩展方法类NodeExtensions,提供多种实用的节点操作方法 - 新增资源目录系统AbstractAssetCatalogSystem用于管理游戏资源 - 实现音频管理系统AbstractAudioManagerSystem支持背景音乐和音效播放 - 添加取消注册扩展方法UnRegisterExtension - 创建GFramework.Game项目模块 - 重构项目结构,聚合核心模块并优化依赖引用 - [no tag]
23 lines
907 B
C#
23 lines
907 B
C#
using GFramework.Core.events;
|
||
using Godot;
|
||
|
||
namespace GFramework.Godot.extensions;
|
||
|
||
/// <summary>
|
||
/// 提供取消注册扩展方法的静态类
|
||
/// </summary>
|
||
public static class UnRegisterExtension
|
||
{
|
||
/// <summary>
|
||
/// 当节点退出场景树时自动取消注册监听器
|
||
/// </summary>
|
||
/// <param name="unRegister">需要在节点退出时被取消注册的监听器接口实例</param>
|
||
/// <param name="node">Godot节点对象,当该节点退出场景树时触发取消注册操作</param>
|
||
/// <returns>返回传入的原始IUnRegister实例,支持链式调用</returns>
|
||
public static IUnRegister UnRegisterWhenNodeExitTree(this IUnRegister unRegister, Node node)
|
||
{
|
||
// 监听节点的TreeExiting事件,在节点即将退出场景树时执行取消注册操作
|
||
node.TreeExiting += unRegister.UnRegister;
|
||
return unRegister;
|
||
}
|
||
} |