GwWuYou d8fd3745c5 refactor(core): 修正命名空间路径错误
- 将命名空间从 `GFramework.Core.Godot.godot.extensions` 更正为 `GFramework.Core.Godot.extensions`
- 移除了重复的 `godot` 路径段,确保命名空间结构清晰一致
2025-12-11 11:13:46 +08:00

23 lines
904 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.

using GFramework.Core.events;
using Godot;
namespace GFramework.Core.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;
}
}