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
5e45942cc1
commit
012378f41b
@ -209,11 +209,8 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Utils
|
#region Utils
|
||||||
internal interface IInjectedProperty
|
internal interface IInjectedProperty
|
||||||
{
|
{
|
||||||
public bool IsCanSet { get; }
|
|
||||||
public bool IsCanGet { get; }
|
|
||||||
public bool IsInjected { get; }
|
public bool IsInjected { get; }
|
||||||
public Type PropertyType { get; }
|
public Type PropertyType { get; }
|
||||||
MemberInfo GetMember();
|
|
||||||
EcsInjectAttribute GetAutoInjectAttribute();
|
EcsInjectAttribute GetAutoInjectAttribute();
|
||||||
void Inject(object target, object value);
|
void Inject(object target, object value);
|
||||||
}
|
}
|
||||||
@ -221,8 +218,6 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
private FieldInfo _member;
|
private FieldInfo _member;
|
||||||
private EcsInjectAttribute _injectAttribute;
|
private EcsInjectAttribute _injectAttribute;
|
||||||
public bool IsCanSet => true;
|
|
||||||
public bool IsCanGet => true;
|
|
||||||
public bool IsInjected { get; private set; }
|
public bool IsInjected { get; private set; }
|
||||||
public Type PropertyType => _member.FieldType;
|
public Type PropertyType => _member.FieldType;
|
||||||
public InjectedField(FieldInfo member)
|
public InjectedField(FieldInfo member)
|
||||||
@ -230,7 +225,6 @@ namespace DCFApixels.DragonECS
|
|||||||
_member = member;
|
_member = member;
|
||||||
_injectAttribute = member.GetCustomAttribute<EcsInjectAttribute>();
|
_injectAttribute = member.GetCustomAttribute<EcsInjectAttribute>();
|
||||||
}
|
}
|
||||||
public MemberInfo GetMember() => _member;
|
|
||||||
public EcsInjectAttribute GetAutoInjectAttribute() => _injectAttribute;
|
public EcsInjectAttribute GetAutoInjectAttribute() => _injectAttribute;
|
||||||
public void Inject(object target, object value)
|
public void Inject(object target, object value)
|
||||||
{
|
{
|
||||||
@ -242,8 +236,6 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
private PropertyInfo _member;
|
private PropertyInfo _member;
|
||||||
private EcsInjectAttribute _injectAttribute;
|
private EcsInjectAttribute _injectAttribute;
|
||||||
public bool IsCanSet => _member.CanWrite;
|
|
||||||
public bool IsCanGet => _member.CanRead;
|
|
||||||
public bool IsInjected { get; private set; }
|
public bool IsInjected { get; private set; }
|
||||||
public Type PropertyType => _member.PropertyType;
|
public Type PropertyType => _member.PropertyType;
|
||||||
public InjectedProperty(PropertyInfo member)
|
public InjectedProperty(PropertyInfo member)
|
||||||
@ -251,7 +243,6 @@ namespace DCFApixels.DragonECS
|
|||||||
_member = member;
|
_member = member;
|
||||||
_injectAttribute = member.GetCustomAttribute<EcsInjectAttribute>();
|
_injectAttribute = member.GetCustomAttribute<EcsInjectAttribute>();
|
||||||
}
|
}
|
||||||
public MemberInfo GetMember() => _member;
|
|
||||||
public EcsInjectAttribute GetAutoInjectAttribute() => _injectAttribute;
|
public EcsInjectAttribute GetAutoInjectAttribute() => _injectAttribute;
|
||||||
public void Inject(object target, object value)
|
public void Inject(object target, object value)
|
||||||
{
|
{
|
||||||
@ -264,8 +255,6 @@ namespace DCFApixels.DragonECS
|
|||||||
private MethodInfo _member;
|
private MethodInfo _member;
|
||||||
private EcsInjectAttribute _injectAttribute;
|
private EcsInjectAttribute _injectAttribute;
|
||||||
private Type propertyType;
|
private Type propertyType;
|
||||||
public bool IsCanSet => true;
|
|
||||||
public bool IsCanGet => false;
|
|
||||||
public bool IsInjected { get; private set; }
|
public bool IsInjected { get; private set; }
|
||||||
public Type PropertyType => propertyType;
|
public Type PropertyType => propertyType;
|
||||||
public InjectedMethod(MethodInfo member)
|
public InjectedMethod(MethodInfo member)
|
||||||
@ -274,7 +263,6 @@ namespace DCFApixels.DragonECS
|
|||||||
_injectAttribute = member.GetCustomAttribute<EcsInjectAttribute>();
|
_injectAttribute = member.GetCustomAttribute<EcsInjectAttribute>();
|
||||||
propertyType = _member.GetParameters()[0].ParameterType;
|
propertyType = _member.GetParameters()[0].ParameterType;
|
||||||
}
|
}
|
||||||
public MemberInfo GetMember() => _member;
|
|
||||||
public EcsInjectAttribute GetAutoInjectAttribute() => _injectAttribute;
|
public EcsInjectAttribute GetAutoInjectAttribute() => _injectAttribute;
|
||||||
public void Inject(object target, object value)
|
public void Inject(object target, object value)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user