mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 09:54:35 +08:00
rename binding attribute
This commit is contained in:
parent
f25036ae6e
commit
8aae08b21e
@ -6,22 +6,22 @@ using System;
|
|||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
#region Interfaces
|
#region Interfaces
|
||||||
[EcsBindWithRunner(typeof(EcsPreInitProcessRunner))]
|
[BindWithEcsRunner(typeof(EcsPreInitProcessRunner))]
|
||||||
public interface IEcsPreInitProcess : IEcsProcess
|
public interface IEcsPreInitProcess : IEcsProcess
|
||||||
{
|
{
|
||||||
void PreInit();
|
void PreInit();
|
||||||
}
|
}
|
||||||
[EcsBindWithRunner(typeof(EcsInitProcessRunner))]
|
[BindWithEcsRunner(typeof(EcsInitProcessRunner))]
|
||||||
public interface IEcsInitProcess : IEcsProcess
|
public interface IEcsInitProcess : IEcsProcess
|
||||||
{
|
{
|
||||||
void Init();
|
void Init();
|
||||||
}
|
}
|
||||||
[EcsBindWithRunner(typeof(EcsRunProcessRunner))]
|
[BindWithEcsRunner(typeof(EcsRunProcessRunner))]
|
||||||
public interface IEcsRunProcess : IEcsProcess
|
public interface IEcsRunProcess : IEcsProcess
|
||||||
{
|
{
|
||||||
void Run();
|
void Run();
|
||||||
}
|
}
|
||||||
[EcsBindWithRunner(typeof(EcsDestroyProcessRunner))]
|
[BindWithEcsRunner(typeof(EcsDestroyProcessRunner))]
|
||||||
public interface IEcsDestroyProcess : IEcsProcess
|
public interface IEcsDestroyProcess : IEcsProcess
|
||||||
{
|
{
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
@ -5,12 +5,12 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
[EcsBindWithRunner(typeof(EcsPreInjectRunner))]
|
[BindWithEcsRunner(typeof(EcsPreInjectRunner))]
|
||||||
public interface IEcsPreInject : IEcsProcess
|
public interface IEcsPreInject : IEcsProcess
|
||||||
{
|
{
|
||||||
void PreInject(object obj);
|
void PreInject(object obj);
|
||||||
}
|
}
|
||||||
[EcsBindWithRunner(typeof(EcsInjectRunner<>))]
|
[BindWithEcsRunner(typeof(EcsInjectRunner<>))]
|
||||||
public interface IEcsInject<T> : IEcsProcess
|
public interface IEcsInject<T> : IEcsProcess
|
||||||
{
|
{
|
||||||
void Inject(T obj);
|
void Inject(T obj);
|
||||||
|
@ -27,11 +27,11 @@ namespace DCFApixels.DragonECS
|
|||||||
[UnityEngine.Scripting.RequireDerived, UnityEngine.Scripting.Preserve]
|
[UnityEngine.Scripting.RequireDerived, UnityEngine.Scripting.Preserve]
|
||||||
#endif
|
#endif
|
||||||
[AttributeUsage(AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class EcsBindWithRunnerAttribute : Attribute
|
public sealed class BindWithEcsRunnerAttribute : Attribute
|
||||||
{
|
{
|
||||||
private static readonly Type baseType = typeof(EcsRunner<>);
|
private static readonly Type _baseType = typeof(EcsRunner<>);
|
||||||
public readonly Type runnerType;
|
public readonly Type runnerType;
|
||||||
public EcsBindWithRunnerAttribute(Type runnerType)
|
public BindWithEcsRunnerAttribute(Type runnerType)
|
||||||
{
|
{
|
||||||
if (runnerType == null)
|
if (runnerType == null)
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
@ -41,7 +41,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
private bool Check(Type type)
|
private bool Check(Type type)
|
||||||
{
|
{
|
||||||
if (type.IsGenericType && type.GetGenericTypeDefinition() == baseType)
|
if (type.IsGenericType && type.GetGenericTypeDefinition() == _baseType)
|
||||||
return true;
|
return true;
|
||||||
if (type.BaseType != null)
|
if (type.BaseType != null)
|
||||||
return Check(type.BaseType);
|
return Check(type.BaseType);
|
||||||
@ -216,7 +216,7 @@ namespace DCFApixels.DragonECS
|
|||||||
if(_subclass == null)
|
if(_subclass == null)
|
||||||
{
|
{
|
||||||
Type interfaceType = typeof(TInterface);
|
Type interfaceType = typeof(TInterface);
|
||||||
if (interfaceType.TryGetAttribute(out EcsBindWithRunnerAttribute atr))
|
if (interfaceType.TryGetAttribute(out BindWithEcsRunnerAttribute atr))
|
||||||
{
|
{
|
||||||
Type runnerType = atr.runnerType;
|
Type runnerType = atr.runnerType;
|
||||||
if (interfaceType.IsGenericType)
|
if (interfaceType.IsGenericType)
|
||||||
|
Loading…
Reference in New Issue
Block a user