2023-04-21 17:39:06 +08:00
|
|
|
|
using System;
|
2023-05-07 00:50:23 +08:00
|
|
|
|
using System.Linq;
|
2023-04-21 17:39:06 +08:00
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS
|
|
|
|
|
{
|
2023-05-07 00:50:23 +08:00
|
|
|
|
public class InjectAttribute : Attribute { }
|
2023-04-21 17:39:06 +08:00
|
|
|
|
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
|
2023-05-07 00:50:23 +08:00
|
|
|
|
public sealed class IncAttribute : InjectAttribute { }
|
2023-04-21 17:39:06 +08:00
|
|
|
|
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
|
2023-05-07 00:50:23 +08:00
|
|
|
|
public sealed class ExcAttribute : InjectAttribute { }
|
2023-04-24 16:48:46 +08:00
|
|
|
|
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
|
2023-05-07 00:50:23 +08:00
|
|
|
|
public sealed class OptAttribute : InjectAttribute { }
|
|
|
|
|
|
|
|
|
|
public abstract class ImplicitInjectAttribute : Attribute { }
|
|
|
|
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
|
|
|
|
|
public sealed class IncImplicitAttribute : ImplicitInjectAttribute
|
|
|
|
|
{
|
|
|
|
|
public readonly Type type;
|
|
|
|
|
public readonly bool isPool;
|
|
|
|
|
|
|
|
|
|
public IncImplicitAttribute(Type type)
|
|
|
|
|
{
|
|
|
|
|
this.type = type;
|
2023-06-04 19:42:46 +08:00
|
|
|
|
isPool = type.GetInterfaces().Any(o => o == typeof(IEcsPoolImplementation));
|
2023-05-07 00:50:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
|
|
|
|
|
public sealed class ExcImplicitAttribute : ImplicitInjectAttribute
|
|
|
|
|
{
|
|
|
|
|
public readonly Type type;
|
|
|
|
|
public readonly bool isPool;
|
|
|
|
|
public ExcImplicitAttribute(Type type)
|
|
|
|
|
{
|
|
|
|
|
this.type = type;
|
2023-06-04 19:42:46 +08:00
|
|
|
|
isPool = type.GetInterfaces().Any(o => o == typeof(IEcsPoolImplementation));
|
2023-05-07 00:50:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-21 17:39:06 +08:00
|
|
|
|
}
|
|
|
|
|
|