update meta

This commit is contained in:
Mikhail 2024-06-13 18:04:18 +08:00
parent 818dc4b926
commit c1eaf36ff0
12 changed files with 124 additions and 59 deletions

View File

@ -6,32 +6,32 @@ namespace DCFApixels.DragonECS
{ {
[MetaName(nameof(PreInit))] [MetaName(nameof(PreInit))]
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "The process to run when EcsPipeline.Init() is called. Before Init")]
public interface IEcsPreInit : IEcsProcess public interface IEcsPreInit : IEcsProcess
{ {
void PreInit(); void PreInit();
} }
[MetaName(nameof(Init))] [MetaName(nameof(Init))]
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "The process to run when EcsPipeline.Init() is called. After PreInit")]
public interface IEcsInit : IEcsProcess public interface IEcsInit : IEcsProcess
{ {
void Init(); void Init();
} }
[MetaName(nameof(Run))] [MetaName(nameof(Run))]
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "The process to run when EcsPipeline.Run() is called.")]
public interface IEcsRun : IEcsProcess public interface IEcsRun : IEcsProcess
{ {
void Run(); void Run();
} }
[MetaName(nameof(Destroy))] [MetaName(nameof(Destroy))]
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "The process to run when EcsPipeline.Destroy() is called.")]
public interface IEcsDestroy : IEcsProcess public interface IEcsDestroy : IEcsProcess
{ {
void Destroy(); void Destroy();
@ -46,8 +46,9 @@ namespace DCFApixels.DragonECS.Internal
[Il2CppSetOption(Option.ArrayBoundsChecks, false)] [Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif #endif
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal sealed class EcsPreInitRunner : EcsRunner<IEcsPreInit>, IEcsPreInit internal sealed class EcsPreInitRunner : EcsRunner<IEcsPreInit>, IEcsPreInit
{ {
#if DEBUG && !DISABLE_DEBUG #if DEBUG && !DISABLE_DEBUG
@ -103,8 +104,9 @@ namespace DCFApixels.DragonECS.Internal
[Il2CppSetOption(Option.ArrayBoundsChecks, false)] [Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif #endif
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal sealed class EcsInitRunner : EcsRunner<IEcsInit>, IEcsInit internal sealed class EcsInitRunner : EcsRunner<IEcsInit>, IEcsInit
{ {
#if DEBUG && !DISABLE_DEBUG #if DEBUG && !DISABLE_DEBUG
@ -157,8 +159,9 @@ namespace DCFApixels.DragonECS.Internal
[Il2CppSetOption(Option.ArrayBoundsChecks, false)] [Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif #endif
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal sealed class EcsRunRunner : EcsRunner<IEcsRun>, IEcsRun internal sealed class EcsRunRunner : EcsRunner<IEcsRun>, IEcsRun
{ {
#if DEBUG && !DISABLE_DEBUG #if DEBUG && !DISABLE_DEBUG
@ -211,8 +214,9 @@ namespace DCFApixels.DragonECS.Internal
[Il2CppSetOption(Option.ArrayBoundsChecks, false)] [Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif #endif
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal sealed class EcsDestroyRunner : EcsRunner<IEcsDestroy>, IEcsDestroy internal sealed class EcsDestroyRunner : EcsRunner<IEcsDestroy>, IEcsDestroy
{ {
#if DEBUG && !DISABLE_DEBUG #if DEBUG && !DISABLE_DEBUG

View File

@ -2,9 +2,10 @@
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
/// <summary> EcsWrold for store regular game entities. </summary>
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, "Worlds")] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.WORLDS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "Inherits EcsWorld without extending its functionality and is used for specific injections. Can be used to store regular game entities, can also be used as a single world in the game for all entities.")]
[DebuggerTypeProxy(typeof(DebuggerProxy))] [DebuggerTypeProxy(typeof(DebuggerProxy))]
public sealed class EcsDefaultWorld : EcsWorld, IInjectionUnit public sealed class EcsDefaultWorld : EcsWorld, IInjectionUnit
{ {
@ -15,9 +16,10 @@ namespace DCFApixels.DragonECS
initer.AddNode<EcsDefaultWorld>(); initer.AddNode<EcsDefaultWorld>();
} }
} }
/// <summary> EcsWrold for store event entities. </summary>
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, "Worlds")] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.WORLDS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "Inherits EcsWorld without extending its functionality and is used for specific injections. Can be used to store event entities.")]
[DebuggerTypeProxy(typeof(DebuggerProxy))] [DebuggerTypeProxy(typeof(DebuggerProxy))]
public sealed class EcsEventWorld : EcsWorld, IInjectionUnit public sealed class EcsEventWorld : EcsWorld, IInjectionUnit
{ {

View File

@ -23,10 +23,16 @@
/// meta subgroups /// meta subgroups
public const string PACK_GROUP = "_" + FRAMEWORK_NAME + "/_Core";
public const string WORLDS_GROUP = "Worlds"; public const string WORLDS_GROUP = "Worlds";
public const string DI_GROUP = "DI"; public const string DI_GROUP = "DI";
public const string POOLS_GROUP = "Pools"; public const string POOLS_GROUP = "Pools";
public const string FRAMEWORK_GROUP = "_" + FRAMEWORK_NAME; public const string PROCESSES_GROUP = "Processes";
public const string DEBUG_GROUP = "Debug";
public const string OTHER_GROUP = "Other";
public const string COMPONENTS_GROUP = "Components";
public const string SYSTEMS_GROUP = "Systems";
/// defs /// defs

View File

@ -36,6 +36,9 @@ namespace DCFApixels.DragonECS
public static explicit operator EcsProfilerMarker(string markerName) { return new EcsProfilerMarker(markerName); } public static explicit operator EcsProfilerMarker(string markerName) { return new EcsProfilerMarker(markerName); }
} }
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.DEBUG_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "Debugging utility. To modify or change the behavior, create a new class inherited from DebugService and set this service using DebugService.Set<T>().")]
public static class EcsDebug public static class EcsDebug
{ {
public const string WARNING_TAG = EcsConsts.DEBUG_WARNING_TAG; public const string WARNING_TAG = EcsConsts.DEBUG_WARNING_TAG;

View File

@ -1,5 +1,4 @@
using DCFApixels.DragonECS.Internal; using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.PoolsCore;
using DCFApixels.DragonECS.RunnersCore; using DCFApixels.DragonECS.RunnersCore;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -19,11 +18,11 @@ namespace DCFApixels.DragonECS
IReadOnlyList<string> Tags { get; } IReadOnlyList<string> Tags { get; }
} }
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)]
[MetaColor(MetaColor.DragonRose)]
[MetaDescription(EcsConsts.AUTHOR, "Intended for extending meta information of types, for customization of type display in the editor. You can get it by using the object.GetMeta() or Type.ToMeta() extension method.")]
[DebuggerTypeProxy(typeof(DebuggerProxy))]
/// <summary> Expanding meta information over Type. </summary> /// <summary> Expanding meta information over Type. </summary>
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.DEBUG_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "Intended for extending meta information of types, for customization of type display in the editor. You can get it by using the object.GetMeta() or Type.ToMeta() extension method. Meta information is collected from meta attributes.")]
[DebuggerTypeProxy(typeof(DebuggerProxy))]
public sealed class TypeMeta : ITypeMeta public sealed class TypeMeta : ITypeMeta
{ {
private static readonly Dictionary<Type, TypeMeta> _metaCache = new Dictionary<Type, TypeMeta>(); private static readonly Dictionary<Type, TypeMeta> _metaCache = new Dictionary<Type, TypeMeta>();
@ -35,6 +34,8 @@ namespace DCFApixels.DragonECS
private bool _isHidden; private bool _isHidden;
private string _name; private string _name;
private string _typeName;
private MetaColor _color; private MetaColor _color;
private MetaDescription _description; private MetaDescription _description;
private MetaGroup _group; private MetaGroup _group;
@ -43,7 +44,7 @@ namespace DCFApixels.DragonECS
private InitFlag _initFlags = InitFlag.None; private InitFlag _initFlags = InitFlag.None;
private EcsMemberType _memberType; //private EcsMemberType _memberType;
#region Constructors #region Constructors
public static TypeMeta Get(Type type) public static TypeMeta Get(Type type)
@ -58,17 +59,6 @@ namespace DCFApixels.DragonECS
private TypeMeta(Type type) private TypeMeta(Type type)
{ {
_type = type; _type = type;
Type runnerType = typeof(EcsRunner<>);
Type processMember = typeof(IEcsProcess);
if (type.IsInterface == false && processMember.IsAssignableFrom(type) && runnerType.IsAssignableFrom(type) == false)
{
_memberType = EcsMemberType.System;
return;
}
_memberType = EcsMemberType.Other;
} }
#endregion #endregion
@ -79,12 +69,12 @@ namespace DCFApixels.DragonECS
} }
#endregion #endregion
#region EcsMemberType //#region EcsMemberType
public EcsMemberType EcsMemberType //public EcsMemberType EcsMemberType
{ //{
get { return _memberType; } // get { return _memberType; }
} //}
#endregion //#endregion
#region Name #region Name
private void InitName() private void InitName()
@ -92,6 +82,14 @@ namespace DCFApixels.DragonECS
if (_initFlags.HasFlag(InitFlag.Name) == false) if (_initFlags.HasFlag(InitFlag.Name) == false)
{ {
(_name, _isCustomName) = MetaGenerator.GetMetaName(_type); (_name, _isCustomName) = MetaGenerator.GetMetaName(_type);
if (_isCustomName)
{
_typeName = MetaGenerator.GetTypeName(_type);
}
else
{
_typeName = _name;
}
_initFlags |= InitFlag.Name; _initFlags |= InitFlag.Name;
} }
} }
@ -111,6 +109,14 @@ namespace DCFApixels.DragonECS
return _name; return _name;
} }
} }
public string TypeName
{
get
{
InitName();
return _typeName;
}
}
#endregion #endregion
#region Color #region Color
@ -303,7 +309,11 @@ namespace DCFApixels.DragonECS
} }
#endregion #endregion
#region GetMetaName #region GetMetaName/GetTypeName
public static string GetTypeName(Type type)
{
return EcsDebugUtility.GetGenericTypeName(type, GENERIC_NAME_DEPTH);
}
public static (string, bool) GetMetaName(Type type) public static (string, bool) GetMetaName(Type type)
{ {
bool isCustom = type.TryGetCustomAttribute(out MetaNameAttribute atr) && string.IsNullOrEmpty(atr.name) == false; bool isCustom = type.TryGetCustomAttribute(out MetaNameAttribute atr) && string.IsNullOrEmpty(atr.name) == false;

View File

@ -9,14 +9,23 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
public interface IEcsPipelineMember : IEcsProcess public interface IEcsPipelineMember : IEcsProcess
{ {
EcsPipeline Pipeline { get; set; } EcsPipeline Pipeline { get; set; }
} }
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
public interface IEcsSystemDefaultLayer : IEcsProcess public interface IEcsSystemDefaultLayer : IEcsProcess
{ {
string Layer { get; } string Layer { get; }
} }
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "Container and engine for systems. Responsible for configuring the execution order of systems, providing a mechanism for messaging between systems, and a dependency injection mechanism.")]
public sealed class EcsPipeline public sealed class EcsPipeline
{ {
private readonly IConfigContainer _configs; private readonly IConfigContainer _configs;
@ -497,7 +506,7 @@ namespace DCFApixels.DragonECS
#region SystemsLayerMarkerSystem #region SystemsLayerMarkerSystem
[MetaTags(MetaTags.HIDDEN)] [MetaTags(MetaTags.HIDDEN)]
[MetaColor(MetaColor.Black)] [MetaColor(MetaColor.Black)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "An auxiliary type of system for dividing a pipeline into layers. This system is automatically added to the EcsPipeline.")] [MetaDescription(EcsConsts.AUTHOR, "An auxiliary type of system for dividing a pipeline into layers. This system is automatically added to the EcsPipeline.")]
public class SystemsLayerMarkerSystem : IEcsProcess public class SystemsLayerMarkerSystem : IEcsProcess
{ {

View File

@ -7,6 +7,10 @@ using static DCFApixels.DragonECS.EcsDebugUtility;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
public interface IEcsProcess : IEcsMember { } public interface IEcsProcess : IEcsMember { }
namespace RunnersCore namespace RunnersCore
@ -53,6 +57,11 @@ namespace DCFApixels.DragonECS
} }
#endregion #endregion
} }
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
public interface IEcsRunner : IEcsProcess public interface IEcsRunner : IEcsProcess
{ {
EcsPipeline Pipeline { get; } EcsPipeline Pipeline { get; }
@ -61,6 +70,10 @@ namespace DCFApixels.DragonECS
bool IsEmpty { get; } bool IsEmpty { get; }
} }
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
public abstract class EcsRunner<TProcess> : EcsRunner, IEcsRunner, IEcsProcess public abstract class EcsRunner<TProcess> : EcsRunner, IEcsRunner, IEcsProcess
where TProcess : IEcsProcess where TProcess : IEcsProcess
{ {

View File

@ -10,6 +10,8 @@ namespace DCFApixels.DragonECS
{ {
#if ENABLE_IL2CPP #if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices; using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif #endif
public class EcsWorldConfig public class EcsWorldConfig
{ {
@ -29,13 +31,13 @@ namespace DCFApixels.DragonECS
} }
} }
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsConsts.WORLDS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "It is a container for entities and components.")]
#if ENABLE_IL2CPP #if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)] [Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)] [Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif #endif
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.WORLDS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "It is a container for entities and components.")]
[DebuggerTypeProxy(typeof(DebuggerProxy))] [DebuggerTypeProxy(typeof(DebuggerProxy))]
public partial class EcsWorld : IEntityStorage, IEcsMember public partial class EcsWorld : IEntityStorage, IEcsMember
{ {

View File

@ -6,16 +6,16 @@ namespace DCFApixels.DragonECS
{ {
[MetaName(nameof(Inject))] [MetaName(nameof(Inject))]
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsConsts.DI_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.DI_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "The interface of the dependency injection process.")]
public interface IEcsInject<T> : IEcsProcess public interface IEcsInject<T> : IEcsProcess
{ {
void Inject(T obj); void Inject(T obj);
} }
[MetaName(nameof(OnInitInjectionComplete))] [MetaName(nameof(OnInitInjectionComplete))]
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsConsts.DI_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.DI_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")] [MetaDescription(EcsConsts.AUTHOR, "The process interface that signals the completion of injection during pipeline initialization via the EcsPipeline.Init() method.")]
public interface IOnInitInjectionComplete : IEcsProcess public interface IOnInitInjectionComplete : IEcsProcess
{ {
void OnInitInjectionComplete(); void OnInitInjectionComplete();

View File

@ -11,15 +11,18 @@ using Unity.IL2CPP.CompilerServices;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
/// <summary>Standard component</summary> /// <summary>Standard component</summary>
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.POOLS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "Standard component.")]
public interface IEcsComponent : IEcsMember { } public interface IEcsComponent : IEcsMember { }
/// <summary>Pool for IEcsComponent components</summary>
#if ENABLE_IL2CPP #if ENABLE_IL2CPP
[Il2CppSetOption (Option.NullChecks, false)] [Il2CppSetOption (Option.NullChecks, false)]
#endif #endif
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsConsts.POOLS_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.POOLS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "Pool for IEcsComponent components.")] [MetaDescription(EcsConsts.AUTHOR, "Pool for IEcsComponent components.")]
/// <summary>Pool for IEcsComponent components</summary>
public sealed class EcsPool<T> : IEcsPoolImplementation<T>, IEcsStructPool<T>, IEnumerable<T> //IEnumerable<T> - IntelliSense hack public sealed class EcsPool<T> : IEcsPoolImplementation<T>, IEcsStructPool<T>, IEnumerable<T> //IEnumerable<T> - IntelliSense hack
where T : struct, IEcsComponent where T : struct, IEcsComponent
{ {

View File

@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS.PoolsCore namespace DCFApixels.DragonECS.PoolsCore
{ {
public interface IEcsMember { } public interface IEcsMember { }
/// <summary>Only used to implement a custom pool. In other contexts use IEcsPool or IEcsPool<T>.</summary> /// <summary>Only used to implement a custom pool. In other contexts use IEcsPool or IEcsPool<T>.</summary>
public interface IEcsPoolImplementation : IEcsPool public interface IEcsPoolImplementation : IEcsPool
{ {
@ -17,6 +18,7 @@ namespace DCFApixels.DragonECS.PoolsCore
void OnWorldDestroy(); void OnWorldDestroy();
#endregion #endregion
} }
/// <summary>Only used to implement a custom pool. In other contexts use IEcsPool or IEcsPool<T>.</summary> /// <summary>Only used to implement a custom pool. In other contexts use IEcsPool or IEcsPool<T>.</summary>
/// <typeparam name="T">Component type</typeparam> /// <typeparam name="T">Component type</typeparam>
public interface IEcsPoolImplementation<T> : IEcsPoolImplementation { } public interface IEcsPoolImplementation<T> : IEcsPoolImplementation { }
@ -48,7 +50,10 @@ namespace DCFApixels.DragonECS.PoolsCore
namespace DCFApixels.DragonECS.Internal namespace DCFApixels.DragonECS.Internal
{ {
public struct NullComponent { } [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.POOLS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "A placeholder type, an instance of this type replaces the null ref.")]
[MetaTags(MetaTags.HIDDEN)]
public sealed class EcsNullPool : IEcsPoolImplementation<NullComponent> public sealed class EcsNullPool : IEcsPoolImplementation<NullComponent>
{ {
public static readonly EcsNullPool instance = new EcsNullPool(); public static readonly EcsNullPool instance = new EcsNullPool();
@ -136,12 +141,13 @@ namespace DCFApixels.DragonECS.Internal
#endif #endif
#endregion #endregion
} }
public struct NullComponent { }
} }
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
#region Interfaces #region Interfaces
public interface IEcsReadonlyPool public interface IEcsReadonlyPool : IEcsMember
{ {
#region Properties #region Properties
int ComponentTypeID { get; } int ComponentTypeID { get; }
@ -165,6 +171,7 @@ namespace DCFApixels.DragonECS
#endregion #endregion
#endif #endif
} }
public interface IEcsPool : IEcsReadonlyPool public interface IEcsPool : IEcsReadonlyPool
{ {
#region Methods #region Methods
@ -174,6 +181,7 @@ namespace DCFApixels.DragonECS
void ClearAll(); void ClearAll();
#endregion #endregion
} }
/// <summary> A pool for struct components. </summary> /// <summary> A pool for struct components. </summary>
public interface IEcsStructPool<T> : IEcsPool where T : struct public interface IEcsStructPool<T> : IEcsPool where T : struct
{ {
@ -183,6 +191,7 @@ namespace DCFApixels.DragonECS
ref T Get(int entityID); ref T Get(int entityID);
#endregion #endregion
} }
/// <summary> A pool for reference components of type T that instantiates components itself. </summary> /// <summary> A pool for reference components of type T that instantiates components itself. </summary>
public interface IEcsClassPool<T> : IEcsPool where T : class public interface IEcsClassPool<T> : IEcsPool where T : class
{ {
@ -191,7 +200,8 @@ namespace DCFApixels.DragonECS
T Get(int entityID); T Get(int entityID);
#endregion #endregion
} }
/// <summary>A pool for reference components of type T, which does not instantiate components itself but receives components from external sources..</summary>
/// <summary> A pool for reference components of type T, which does not instantiate components itself but receives components from external sources. </summary>
public interface IEcsHybridPool<T> : IEcsPool where T : class public interface IEcsHybridPool<T> : IEcsPool where T : class
{ {
#region Methods #region Methods

View File

@ -10,16 +10,19 @@ using Unity.IL2CPP.CompilerServices;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
/// <summary>Component without data</summary> /// <summary> Component without data. </summary>
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.POOLS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "Tag component or component without data.")]
public interface IEcsTagComponent : IEcsMember { } public interface IEcsTagComponent : IEcsMember { }
/// <summary> Pool for IEcsTagComponent components. </summary>
#if ENABLE_IL2CPP #if ENABLE_IL2CPP
[Il2CppSetOption (Option.NullChecks, false)] [Il2CppSetOption (Option.NullChecks, false)]
#endif #endif
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsConsts.POOLS_GROUP)] [MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.POOLS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "Pool for IEcsTagComponent components. EcsTagPool is optimized for storing tag components or components without data.")] [MetaDescription(EcsConsts.AUTHOR, "Pool for IEcsTagComponent components. EcsTagPool is optimized for storing tag components or components without data.")]
/// <summary>Pool for IEcsTagComponent components</summary>
public sealed class EcsTagPool<T> : IEcsPoolImplementation<T>, IEcsStructPool<T>, IEnumerable<T> //IEnumerable<T> - IntelliSense hack public sealed class EcsTagPool<T> : IEcsPoolImplementation<T>, IEcsStructPool<T>, IEnumerable<T> //IEnumerable<T> - IntelliSense hack
where T : struct, IEcsTagComponent where T : struct, IEcsTagComponent
{ {