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