mirror of
https://github.com/DCFApixels/DragonECS-AutoInjections.git
synced 2025-09-18 05:04:35 +08:00
refactoring
This commit is contained in:
parent
f4ef2fc284
commit
7d55cf82e4
@ -11,7 +11,6 @@ namespace DCFApixels.DragonECS
|
||||
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class OptAttribute : InjectAttribute { }
|
||||
|
||||
|
||||
public abstract class ImplicitInjectAttribute : Attribute { }
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
|
||||
public sealed class IncImplicitAttribute : ImplicitInjectAttribute
|
||||
@ -21,16 +20,8 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
public IncImplicitAttribute(Type type)
|
||||
{
|
||||
if (type.IsValueType && !type.IsPrimitive)
|
||||
{
|
||||
isPool = false;
|
||||
this.type = type;
|
||||
return;
|
||||
}
|
||||
if (!type.GetInterfaces().Any(o => o == typeof(IEcsPoolImplementation)))
|
||||
throw new ArgumentException("Можно использовать только пулы наследованные от IEcsPoolImplementation<T>");
|
||||
this.type = type;
|
||||
isPool = true;
|
||||
isPool = type.GetInterfaces().Any(o => o == typeof(IEcsPoolImplementation));
|
||||
}
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
|
||||
@ -40,16 +31,8 @@ namespace DCFApixels.DragonECS
|
||||
public readonly bool isPool;
|
||||
public ExcImplicitAttribute(Type type)
|
||||
{
|
||||
if (type.IsValueType && !type.IsPrimitive)
|
||||
{
|
||||
isPool = false;
|
||||
this.type = type;
|
||||
return;
|
||||
}
|
||||
if (!type.GetInterfaces().Any(o => o == typeof(IEcsPoolImplementation)))
|
||||
throw new ArgumentException("Можно использовать только пулы наследованные от IEcsPoolImplementation<T>");
|
||||
this.type = type;
|
||||
isPool = true;
|
||||
isPool = type.GetInterfaces().Any(o => o == typeof(IEcsPoolImplementation));
|
||||
}
|
||||
}
|
||||
}
|
@ -20,9 +20,9 @@ namespace DCFApixels.DragonECS
|
||||
Type builderType = b.GetType();
|
||||
MethodInfo incluedMethod = builderType.GetMethod("Include", BindingFlags.Instance | BindingFlags.Public);
|
||||
MethodInfo excludeMethod = builderType.GetMethod("Exclude", BindingFlags.Instance | BindingFlags.Public);
|
||||
MethodInfo optionalMethod = builderType.GetMethod("Optional", BindingFlags.Instance | BindingFlags.Public);
|
||||
MethodInfo includeImplicitMethod = builderType.GetMethod("IncludeImplicit", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
MethodInfo excludeImplicitMethod = builderType.GetMethod("ExcludeImplicit", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
MethodInfo optionalMethod = builderType.GetMethod("Optional", BindingFlags.Instance | BindingFlags.Public);
|
||||
|
||||
Type subjectType = s.GetType();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user