2023-03-29 16:43:06 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS
|
|
|
|
|
{
|
2023-06-10 02:12:22 +08:00
|
|
|
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
|
2024-11-05 12:18:55 +08:00
|
|
|
|
public class DIAttribute : Attribute
|
2023-03-29 16:43:06 +08:00
|
|
|
|
{
|
2024-12-04 17:40:57 +08:00
|
|
|
|
public static readonly DIAttribute Dummy = new DIAttribute();
|
|
|
|
|
public readonly Type NotNullDummyType = null;
|
|
|
|
|
public readonly string NamedInjection = string.Empty;
|
|
|
|
|
public DIAttribute() { }
|
|
|
|
|
public DIAttribute(string namedInjection)
|
2023-04-05 09:14:42 +08:00
|
|
|
|
{
|
2024-12-04 17:40:57 +08:00
|
|
|
|
NamedInjection = namedInjection;
|
|
|
|
|
}
|
|
|
|
|
public DIAttribute(Type notNullDummyType)
|
|
|
|
|
{
|
|
|
|
|
NotNullDummyType = notNullDummyType;
|
|
|
|
|
}
|
|
|
|
|
public DIAttribute(string namedInjection, Type notNullDummyType)
|
|
|
|
|
{
|
|
|
|
|
NamedInjection = namedInjection;
|
|
|
|
|
NotNullDummyType = notNullDummyType;
|
2023-04-05 09:14:42 +08:00
|
|
|
|
}
|
2023-03-29 16:43:06 +08:00
|
|
|
|
}
|
2024-11-05 12:18:55 +08:00
|
|
|
|
|
|
|
|
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
|
|
|
|
|
[Obsolete("Use DI attribute")]
|
|
|
|
|
public sealed class EcsInjectAttribute : DIAttribute
|
|
|
|
|
{
|
|
|
|
|
public EcsInjectAttribute(Type notNullDummyType = null) : base(notNullDummyType) { }
|
|
|
|
|
}
|
2023-03-29 16:43:06 +08:00
|
|
|
|
}
|
|
|
|
|
|