Update TypeMeta.cs

This commit is contained in:
DCFApixels 2025-03-19 09:38:53 +08:00
parent 51bf6092c5
commit 26f141fca9

View File

@ -3,6 +3,7 @@
#endif #endif
using DCFApixels.DragonECS.Core; using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Internal; using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.PoolsCore;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -67,6 +68,7 @@ namespace DCFApixels.DragonECS
private bool _isProcess; private bool _isProcess;
private bool _isComponent; private bool _isComponent;
private bool _isPool;
private InitFlag _initFlags = InitFlag.None; private InitFlag _initFlags = InitFlag.None;
@ -315,6 +317,18 @@ namespace DCFApixels.DragonECS
return _isProcess; return _isProcess;
} }
} }
public bool IsPool
{
get
{
if (_initFlags.HasFlag(InitFlag.ReflectionInfo) == false)
{
MetaGenerator.GetReflectionInfo(this);
_initFlags |= InitFlag.ReflectionInfo;
}
return _isPool;
}
}
#endregion #endregion
#region InitializeAll #region InitializeAll
@ -574,9 +588,9 @@ namespace DCFApixels.DragonECS
#region GetReflectionInfo #region GetReflectionInfo
public static void GetReflectionInfo(TypeMeta meta) public static void GetReflectionInfo(TypeMeta meta)
{ {
var interfaces = meta.Type.GetInterfaces(); meta._isComponent = typeof(IEcsComponentMember).IsAssignableFrom(meta.Type);
meta._isComponent = Array.IndexOf(interfaces, typeof(IEcsComponentMember)) >= 0; meta._isProcess = typeof(IEcsProcess).IsAssignableFrom(meta.Type);
meta._isProcess = Array.IndexOf(interfaces, typeof(IEcsProcess)) >= 0; meta._isPool = typeof(IEcsPoolImplementation).IsAssignableFrom(meta.Type);
} }
#endregion #endregion
} }