#nullable enable
namespace GFramework.Godot.SourceGenerators.Abstractions;
///
/// 标记 Godot 节点事件处理方法,Source Generator 会为其生成事件绑定与解绑逻辑。
///
///
/// 该特性通过节点字段名与事件名建立声明式订阅关系,适用于将
/// _Ready() / _ExitTree() 中重复的 += 与 -= 样板代码
/// 收敛到生成器中统一维护。
///
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
public sealed class BindNodeSignalAttribute : Attribute
{
///
/// 初始化 的新实例。
///
/// 目标节点字段名。
/// 目标节点上的 CLR 事件名。
///
/// 或 为 。
///
public BindNodeSignalAttribute(
string nodeFieldName,
string signalName)
{
NodeFieldName = nodeFieldName ?? throw new ArgumentNullException(nameof(nodeFieldName));
SignalName = signalName ?? throw new ArgumentNullException(nameof(signalName));
}
///
/// 获取目标节点字段名。
///
public string NodeFieldName { get; }
///
/// 获取目标节点上的 CLR 事件名。
///
public string SignalName { get; }
}