From 87c98f708e3af1460178211a1d21ce3bffc745de Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Wed, 15 Apr 2026 14:37:16 +0800 Subject: [PATCH] update meta --- src/Builtin/BaseProcesses.cs | 4 ---- .../MetaAttributes/MetaGroupAttribute.cs | 4 ++++ .../MetaAttributes/MetaProxyAttribute.cs | 10 ++++----- src/DebugUtils/TypeMeta.cs | 12 +++++------ src/EcsRunner.cs | 21 ++++++++++++++++--- src/EcsWorld.static.cs | 2 ++ src/Internal/ReflectionUtility.cs | 8 +++---- src/Pools/EcsPool.cs | 3 +++ src/Pools/EcsTagPool.cs | 3 +++ src/Pools/EcsValuePool.cs | 3 +++ 10 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/Builtin/BaseProcesses.cs b/src/Builtin/BaseProcesses.cs index 1e94974..f21dcfe 100644 --- a/src/Builtin/BaseProcesses.cs +++ b/src/Builtin/BaseProcesses.cs @@ -59,7 +59,6 @@ namespace DCFApixels.DragonECS.Core.Internal #endif [MetaColor(MetaColor.DragonRose)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)] - [MetaDescription(EcsConsts.AUTHOR, "...")] [MetaTags(MetaTags.HIDDEN)] [MetaID("DragonECS_3273527C9201285BAA0A463F700A50FB")] internal sealed class EcsPreInitRunner : EcsRunner, IEcsPreInit @@ -80,7 +79,6 @@ namespace DCFApixels.DragonECS.Core.Internal #endif [MetaColor(MetaColor.DragonRose)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)] - [MetaDescription(EcsConsts.AUTHOR, "...")] [MetaTags(MetaTags.HIDDEN)] [MetaID("DragonECS_ED85527C9201A391AB8EC0B734917859")] internal sealed class EcsInitRunner : EcsRunner, IEcsInit @@ -101,7 +99,6 @@ namespace DCFApixels.DragonECS.Core.Internal #endif [MetaColor(MetaColor.DragonRose)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)] - [MetaDescription(EcsConsts.AUTHOR, "...")] [MetaTags(MetaTags.HIDDEN)] [MetaID("DragonECS_2098527C9201F260C840BFD50BC7E0BA")] internal sealed class EcsRunRunner : EcsRunner, IEcsRun @@ -182,7 +179,6 @@ namespace DCFApixels.DragonECS.Core.Internal #endif [MetaColor(MetaColor.DragonRose)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)] - [MetaDescription(EcsConsts.AUTHOR, "...")] [MetaTags(MetaTags.HIDDEN)] [MetaID("DragonECS_06A6527C92010430ACEB3DA520F272CC")] internal sealed class EcsDestroyRunner : EcsRunner, IEcsDestroy diff --git a/src/DebugUtils/MetaAttributes/MetaGroupAttribute.cs b/src/DebugUtils/MetaAttributes/MetaGroupAttribute.cs index bb41627..020c930 100644 --- a/src/DebugUtils/MetaAttributes/MetaGroupAttribute.cs +++ b/src/DebugUtils/MetaAttributes/MetaGroupAttribute.cs @@ -73,6 +73,10 @@ namespace DCFApixels.DragonECS } return new MetaGroup(name); } + public static MetaGroup FromName(params string[] path) + { + return FromName(string.Join(SEPARATOR, path)); + } public static MetaGroup FromNameSpace(Type type) { if (string.IsNullOrWhiteSpace(type.Namespace)) diff --git a/src/DebugUtils/MetaAttributes/MetaProxyAttribute.cs b/src/DebugUtils/MetaAttributes/MetaProxyAttribute.cs index 979f755..120d530 100644 --- a/src/DebugUtils/MetaAttributes/MetaProxyAttribute.cs +++ b/src/DebugUtils/MetaAttributes/MetaProxyAttribute.cs @@ -11,23 +11,21 @@ namespace DCFApixels.DragonECS public sealed class MetaProxyAttribute : DragonMetaAttribute { public Type Type; - public MetaProxyAttribute(Type type) + public bool ForDeclaringType; + public MetaProxyAttribute(Type type, bool forDeclaringType = false) { Type = type; + ForDeclaringType = forDeclaringType; } } public class MetaProxyBase { public static readonly MetaProxyBase EmptyProxy = new MetaProxyBase(typeof(void)); - public readonly Type Type; public virtual string Name { get { return null; } } public virtual MetaColor? Color { get { return null; } } public virtual MetaDescription Description { get { return null; } } public virtual MetaGroup Group { get { return null; } } public virtual IEnumerable Tags { get { return null; } } - public MetaProxyBase(Type type) - { - Type = type; - } + public MetaProxyBase(Type type) { } } } \ No newline at end of file diff --git a/src/DebugUtils/TypeMeta.cs b/src/DebugUtils/TypeMeta.cs index 3dde789..d5bbfee 100644 --- a/src/DebugUtils/TypeMeta.cs +++ b/src/DebugUtils/TypeMeta.cs @@ -125,27 +125,25 @@ namespace DCFApixels.DragonECS _type = type; _proxy = MetaProxyBase.EmptyProxy; - if (type.ContainsGenericParameters == false && - type.TryGetAttributeInherited(out var proxyAtr, out var declareAtrType)) + if (type.TryGetAttributeInherited(out var proxyAtr, out var declaringAtrType)) { Type proxyType = proxyAtr.Type; if (proxyType.ContainsGenericParameters && proxyType.IsNested) { - var baseType = FindDeclaringType(proxyType.DeclaringType, type); - if(baseType != null) + if (declaringAtrType != null && declaringAtrType.ContainsGenericParameters == false) { - var args = baseType.GetGenericArguments(); + var args = declaringAtrType.GetGenericArguments(); proxyType = proxyType.MakeGenericType(args); } } if (proxyType.ContainsGenericParameters == false) { - var proxy = Activator.CreateInstance(proxyType, type) as MetaProxyBase; + var proxy = Activator.CreateInstance(proxyType, proxyAtr.ForDeclaringType ? declaringAtrType : type) as MetaProxyBase; if (proxy != null) { _proxy = proxy; - _isSelfProxy = declareAtrType == type; + _isSelfProxy = declaringAtrType == type; } } } diff --git a/src/EcsRunner.cs b/src/EcsRunner.cs index 054cef3..82e7486 100644 --- a/src/EcsRunner.cs +++ b/src/EcsRunner.cs @@ -63,6 +63,23 @@ namespace DCFApixels.DragonECS #endregion public delegate void ActionWithData(TProcess process, ref T Data); + + #region MetaProxy + protected class RunnerMetaProxy : MetaProxyBase + { + private TypeMeta _processMeta; + public override MetaColor? Color => MetaColor.DragonRose; + public override MetaDescription Description => new MetaDescription(EcsConsts.AUTHOR, $"Runner for {_processMeta.TypeName} process."); + public override MetaGroup Group => MetaGroup.FromName(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP); + public RunnerMetaProxy(Type type) : base(type) + { + if (type.IsGenericType) + { + _processMeta = type.GetGenericArguments()[0].GetMeta(); + } + } + } + #endregion } [MetaColor(MetaColor.DragonRose)] @@ -80,9 +97,9 @@ namespace DCFApixels.DragonECS [MetaColor(MetaColor.DragonRose)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] - [MetaDescription(EcsConsts.AUTHOR, "...")] [MetaTags(MetaTags.HIDDEN)] [MetaID("DragonECS_7DB3557C9201F85E0E1C17D7B19D9CEE")] + [MetaProxy(typeof(RunnerMetaProxy), true)] public abstract class EcsRunner : EcsRunner, IEcsRunner, IEcsProcess where TProcess : IEcsProcess { @@ -476,8 +493,6 @@ namespace DCFApixels.DragonECS #endregion } #endregion - - //---- } } diff --git a/src/EcsWorld.static.cs b/src/EcsWorld.static.cs index 5e18422..d00b38b 100644 --- a/src/EcsWorld.static.cs +++ b/src/EcsWorld.static.cs @@ -294,6 +294,8 @@ namespace DCFApixels.DragonECS #endregion #region NullWorld + [MetaTags(MetaTags.HIDDEN)] + [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] private sealed class NullWorld : EcsWorld { internal NullWorld() : base(new EcsWorldConfig(4, 4, 4, 4, 4), null, 0) { } diff --git a/src/Internal/ReflectionUtility.cs b/src/Internal/ReflectionUtility.cs index 1ea66fa..fb9068b 100644 --- a/src/Internal/ReflectionUtility.cs +++ b/src/Internal/ReflectionUtility.cs @@ -19,21 +19,21 @@ namespace DCFApixels.DragonECS.Core.Internal return type; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryGetAttributeInherited(this Type self, out T attribute, out Type declareAtrType) where T : Attribute + public static bool TryGetAttributeInherited(this Type self, out T attribute, out Type declaringAtrType) where T : Attribute { if (self == null || self == typeof(object)) { attribute = null; - declareAtrType = null; + declaringAtrType = null; return false; } attribute = self.GetCustomAttribute(); if (attribute == null) { - return self.BaseType.TryGetAttributeInherited(out attribute, out declareAtrType); + return self.BaseType.TryGetAttributeInherited(out attribute, out declaringAtrType); } - declareAtrType = self; + declaringAtrType = self; return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/Pools/EcsPool.cs b/src/Pools/EcsPool.cs index db479f0..6986d0a 100644 --- a/src/Pools/EcsPool.cs +++ b/src/Pools/EcsPool.cs @@ -400,6 +400,9 @@ namespace DCFApixels.DragonECS #if ENABLE_IL2CPP [Il2CppSetOption(Option.NullChecks, false)] #endif + [MetaTags(MetaTags.HIDDEN)] + [MetaColor(MetaColor.DragonRose)] + [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] [EditorBrowsable(EditorBrowsableState.Never)] public readonly struct ReadonlyEcsPool : IEcsReadonlyPool //IEnumerable - IntelliSense hack where T : struct, IEcsComponent diff --git a/src/Pools/EcsTagPool.cs b/src/Pools/EcsTagPool.cs index 8ec8a96..644a168 100644 --- a/src/Pools/EcsTagPool.cs +++ b/src/Pools/EcsTagPool.cs @@ -343,6 +343,9 @@ namespace DCFApixels.DragonECS #if ENABLE_IL2CPP [Il2CppSetOption(Option.NullChecks, false)] #endif + [MetaTags(MetaTags.HIDDEN)] + [MetaColor(MetaColor.DragonRose)] + [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] [EditorBrowsable(EditorBrowsableState.Never)] public readonly struct ReadonlyEcsTagPool : IEcsReadonlyPool //IEnumerable - IntelliSense hack where T : struct, IEcsTagComponent diff --git a/src/Pools/EcsValuePool.cs b/src/Pools/EcsValuePool.cs index 93f868d..66d4fb6 100644 --- a/src/Pools/EcsValuePool.cs +++ b/src/Pools/EcsValuePool.cs @@ -408,6 +408,9 @@ namespace DCFApixels.DragonECS #if ENABLE_IL2CPP [Il2CppSetOption(Option.NullChecks, false)] #endif + [MetaTags(MetaTags.HIDDEN)] + [MetaColor(MetaColor.DragonRose)] + [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)] [EditorBrowsable(EditorBrowsableState.Never)] public readonly struct ReadonlyEcsValuePool : IEcsReadonlyPool //IEnumerable - IntelliSense hack where T : unmanaged, IEcsValueComponent