update meta

This commit is contained in:
Mikhail 2026-04-15 14:37:16 +08:00
parent d52c3031f2
commit 87c98f708e
10 changed files with 46 additions and 24 deletions

View File

@ -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>, 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>, 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>, 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>, IEcsDestroy

View File

@ -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))

View File

@ -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<string> Tags { get { return null; } }
public MetaProxyBase(Type type)
{
Type = type;
}
public MetaProxyBase(Type type) { }
}
}

View File

@ -125,27 +125,25 @@ namespace DCFApixels.DragonECS
_type = type;
_proxy = MetaProxyBase.EmptyProxy;
if (type.ContainsGenericParameters == false &&
type.TryGetAttributeInherited<MetaProxyAttribute>(out var proxyAtr, out var declareAtrType))
if (type.TryGetAttributeInherited<MetaProxyAttribute>(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;
}
}
}

View File

@ -63,6 +63,23 @@ namespace DCFApixels.DragonECS
#endregion
public delegate void ActionWithData<in TProcess, T>(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<TProcess> : EcsRunner, IEcsRunner, IEcsProcess
where TProcess : IEcsProcess
{
@ -476,8 +493,6 @@ namespace DCFApixels.DragonECS
#endregion
}
#endregion
//----
}
}

View File

@ -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) { }

View File

@ -19,21 +19,21 @@ namespace DCFApixels.DragonECS.Core.Internal
return type;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryGetAttributeInherited<T>(this Type self, out T attribute, out Type declareAtrType) where T : Attribute
public static bool TryGetAttributeInherited<T>(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<T>();
if (attribute == null)
{
return self.BaseType.TryGetAttributeInherited<T>(out attribute, out declareAtrType);
return self.BaseType.TryGetAttributeInherited<T>(out attribute, out declaringAtrType);
}
declareAtrType = self;
declaringAtrType = self;
return true;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]

View File

@ -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<T> : IEcsReadonlyPool //IEnumerable<T> - IntelliSense hack
where T : struct, IEcsComponent

View File

@ -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<T> : IEcsReadonlyPool //IEnumerable<T> - IntelliSense hack
where T : struct, IEcsTagComponent

View File

@ -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<T> : IEcsReadonlyPool //IEnumerable<T> - IntelliSense hack
where T : unmanaged, IEcsValueComponent