mirror of
https://github.com/DCFApixels/DragonECS-AutoInjections.git
synced 2025-09-17 20:34:34 +08:00
update
This commit is contained in:
parent
c2107dff1a
commit
765373ea4b
@ -3,7 +3,7 @@ using System.Reflection;
|
|||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
public abstract class EcsJoinQueryDI<TAttachComponent> : EcsJoinAttachQuery<TAttachComponent>
|
public abstract class EcsJoinAttachQueryDI<TAttachComponent> : EcsJoinAttachQuery<TAttachComponent>
|
||||||
where TAttachComponent : struct, IEcsAttachComponent
|
where TAttachComponent : struct, IEcsAttachComponent
|
||||||
{
|
{
|
||||||
protected override void Init(Builder b) => EcsQueryDIHelper.Fill(this, b);
|
protected override void Init(Builder b) => EcsQueryDIHelper.Fill(this, b);
|
||||||
@ -22,8 +22,6 @@ namespace DCFApixels.DragonECS
|
|||||||
MethodInfo excludeMethod = builderType.GetMethod("Exclude", BindingFlags.Instance | BindingFlags.Public);
|
MethodInfo excludeMethod = builderType.GetMethod("Exclude", BindingFlags.Instance | BindingFlags.Public);
|
||||||
MethodInfo optionalMethod = builderType.GetMethod("Optional", BindingFlags.Instance | BindingFlags.Public);
|
MethodInfo optionalMethod = builderType.GetMethod("Optional", BindingFlags.Instance | BindingFlags.Public);
|
||||||
|
|
||||||
//PropertyInfo componentTypeProp = builderType.GetProperty("ComponentType", BindingFlags.Instance | BindingFlags.Public);
|
|
||||||
|
|
||||||
Type thisType = q.GetType();
|
Type thisType = q.GetType();
|
||||||
FieldInfo[] fieldInfos = thisType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
FieldInfo[] fieldInfos = thisType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||||
foreach (FieldInfo fieldInfo in fieldInfos)
|
foreach (FieldInfo fieldInfo in fieldInfos)
|
||||||
@ -31,12 +29,9 @@ namespace DCFApixels.DragonECS
|
|||||||
Type fieldType = fieldInfo.FieldType;
|
Type fieldType = fieldInfo.FieldType;
|
||||||
if (fieldType.IsSubclassOf(typeof(EcsPoolBase)) == false)
|
if (fieldType.IsSubclassOf(typeof(EcsPoolBase)) == false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (fieldType.IsGenericType == false)
|
if (fieldType.IsGenericType == false)
|
||||||
continue;
|
continue;
|
||||||
//Type fiedlTypeDefinition = fieldType.GetGenericTypeDefinition();
|
|
||||||
|
|
||||||
//Type componentType = ((EcsPoolBase)componentTypeProp.GetValue(fieldInfo.GetValue(q))).ComponentType;
|
|
||||||
Type componentType = fieldType.GenericTypeArguments[0];
|
Type componentType = fieldType.GenericTypeArguments[0];
|
||||||
|
|
||||||
if (fieldInfo.GetCustomAttribute<IncAttribute>() != null)
|
if (fieldInfo.GetCustomAttribute<IncAttribute>() != null)
|
||||||
@ -49,7 +44,11 @@ namespace DCFApixels.DragonECS
|
|||||||
fieldInfo.SetValue(q, excludeMethod.MakeGenericMethod(componentType, fieldType).Invoke(b, null));
|
fieldInfo.SetValue(q, excludeMethod.MakeGenericMethod(componentType, fieldType).Invoke(b, null));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (fieldInfo.GetCustomAttribute<OptAttribute>() != null)
|
||||||
|
{
|
||||||
fieldInfo.SetValue(q, optionalMethod.MakeGenericMethod(componentType, fieldType).Invoke(b, null));
|
fieldInfo.SetValue(q, optionalMethod.MakeGenericMethod(componentType, fieldType).Invoke(b, null));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user