mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 17:21:16 +08:00
27 lines
959 B
C#
27 lines
959 B
C#
// Copyright (c) 2025-2026 GeWuYou
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
namespace GFramework.Core.SourceGenerators.Abstractions.Rule;
|
|
|
|
/// <summary>
|
|
/// 标记字段需要自动注入系统集合。
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Source Generator 会为标记字段生成从当前架构上下文收集系统实例的注入代码,用于避免在组件内部重复书写
|
|
/// <c>GetSystems()</c> 一类的样板访问逻辑。
|
|
/// 被标记字段应声明为可承载多个系统实例的类型,例如 <c>IEnumerable<ISystem></c> 或兼容集合接口。
|
|
/// </remarks>
|
|
/// <example>
|
|
/// <code>
|
|
/// public partial class CombatPanel : IContextAware
|
|
/// {
|
|
/// [GetSystems]
|
|
/// private IEnumerable<ISystem> _systems = Array.Empty<ISystem>();
|
|
/// }
|
|
/// </code>
|
|
/// </example>
|
|
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
|
|
public sealed class GetSystemsAttribute : Attribute
|
|
{
|
|
}
|