update TypeMeta

This commit is contained in:
DCFApixels 2025-03-17 20:00:27 +08:00
parent b331f4fda1
commit b14adb01ca
3 changed files with 44 additions and 2 deletions

View File

@ -28,6 +28,7 @@ namespace DCFApixels.DragonECS
{ {
get { return string.IsNullOrEmpty(Author) == false; } get { return string.IsNullOrEmpty(Author) == false; }
} }
public MetaDescription(string text) : this(null, text) { }
public MetaDescription(string author, string text) public MetaDescription(string author, string text)
{ {
if (author == null) { author = string.Empty; } if (author == null) { author = string.Empty; }

View File

@ -65,6 +65,9 @@ namespace DCFApixels.DragonECS
private string _metaID; private string _metaID;
private EcsTypeCode _typeCode; private EcsTypeCode _typeCode;
private bool _isProcess;
private bool _isComponent;
private InitFlag _initFlags = InitFlag.None; private InitFlag _initFlags = InitFlag.None;
#region Constructors #region Constructors
@ -287,6 +290,33 @@ namespace DCFApixels.DragonECS
} }
#endregion #endregion
#region ReflectionInfo
public bool IsComponent
{
get
{
if (_initFlags.HasFlag(InitFlag.ReflectionInfo) == false)
{
MetaGenerator.GetReflectionInfo(this);
_initFlags |= InitFlag.ReflectionInfo;
}
return _isComponent;
}
}
public bool IsProcess
{
get
{
if (_initFlags.HasFlag(InitFlag.ReflectionInfo) == false)
{
MetaGenerator.GetReflectionInfo(this);
_initFlags |= InitFlag.ReflectionInfo;
}
return _isProcess;
}
}
#endregion
#region InitializeAll #region InitializeAll
public TypeMeta InitializeAll() public TypeMeta InitializeAll()
{ {
@ -316,9 +346,10 @@ namespace DCFApixels.DragonECS
Tags = 1 << 4, Tags = 1 << 4,
MetaID = 1 << 5, MetaID = 1 << 5,
TypeCode = 1 << 6, TypeCode = 1 << 6,
//MemberType = 1 << 7, ReflectionInfo = 1 << 7,
//MemberType = 1 << 8,
All = Name | Group | Color | Description | Tags | TypeCode | MetaID //| MemberType All = Name | Group | Color | Description | Tags | TypeCode | MetaID | ReflectionInfo //| MemberType
} }
#endregion #endregion
@ -548,6 +579,15 @@ namespace DCFApixels.DragonECS
#endif #endif
} }
#endregion #endregion
#region GetReflectionInfo
public static void GetReflectionInfo(TypeMeta meta)
{
var interfaces = meta.Type.GetInterfaces();
meta._isComponent = Array.IndexOf(interfaces, typeof(IEcsComponentMember)) >= 0;
meta._isProcess = Array.IndexOf(interfaces, typeof(IEcsProcess)) >= 0;
}
#endregion
} }
#endregion #endregion
} }

View File

@ -14,6 +14,7 @@ using static DCFApixels.DragonECS.EcsConsts;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
public interface IEcsMember { } public interface IEcsMember { }
public interface IEcsComponentMember : IEcsMember { }
public interface INamedMember public interface INamedMember
{ {
string Name { get; } string Name { get; }