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

View File

@ -2,9 +2,10 @@
namespace DCFApixels.DragonECS
{
/// <summary> EcsWrold for store regular game entities. </summary>
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, "Worlds")]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.WORLDS_GROUP)]
[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))]
public sealed class EcsDefaultWorld : EcsWorld, IInjectionUnit
{
@ -15,9 +16,10 @@ namespace DCFApixels.DragonECS
initer.AddNode<EcsDefaultWorld>();
}
}
/// <summary> EcsWrold for store event entities. </summary>
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, "Worlds")]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.WORLDS_GROUP)]
[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))]
public sealed class EcsEventWorld : EcsWorld, IInjectionUnit
{

View File

@ -23,10 +23,16 @@
/// meta subgroups
public const string PACK_GROUP = "_" + FRAMEWORK_NAME + "/_Core";
public const string WORLDS_GROUP = "Worlds";
public const string DI_GROUP = "DI";
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

View File

@ -36,6 +36,9 @@ namespace DCFApixels.DragonECS
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 const string WARNING_TAG = EcsConsts.DEBUG_WARNING_TAG;

View File

@ -1,5 +1,4 @@
using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.PoolsCore;
using DCFApixels.DragonECS.RunnersCore;
using System;
using System.Collections.Generic;
@ -19,11 +18,11 @@ namespace DCFApixels.DragonECS
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>
[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
{
private static readonly Dictionary<Type, TypeMeta> _metaCache = new Dictionary<Type, TypeMeta>();
@ -35,6 +34,8 @@ namespace DCFApixels.DragonECS
private bool _isHidden;
private string _name;
private string _typeName;
private MetaColor _color;
private MetaDescription _description;
private MetaGroup _group;
@ -43,7 +44,7 @@ namespace DCFApixels.DragonECS
private InitFlag _initFlags = InitFlag.None;
private EcsMemberType _memberType;
//private EcsMemberType _memberType;
#region Constructors
public static TypeMeta Get(Type type)
@ -58,17 +59,6 @@ namespace DCFApixels.DragonECS
private TypeMeta(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
@ -79,12 +69,12 @@ namespace DCFApixels.DragonECS
}
#endregion
#region EcsMemberType
public EcsMemberType EcsMemberType
{
get { return _memberType; }
}
#endregion
//#region EcsMemberType
//public EcsMemberType EcsMemberType
//{
// get { return _memberType; }
//}
//#endregion
#region Name
private void InitName()
@ -92,6 +82,14 @@ namespace DCFApixels.DragonECS
if (_initFlags.HasFlag(InitFlag.Name) == false)
{
(_name, _isCustomName) = MetaGenerator.GetMetaName(_type);
if (_isCustomName)
{
_typeName = MetaGenerator.GetTypeName(_type);
}
else
{
_typeName = _name;
}
_initFlags |= InitFlag.Name;
}
}
@ -111,6 +109,14 @@ namespace DCFApixels.DragonECS
return _name;
}
}
public string TypeName
{
get
{
InitName();
return _typeName;
}
}
#endregion
#region Color
@ -303,7 +309,11 @@ namespace DCFApixels.DragonECS
}
#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)
{
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
{
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
public interface IEcsPipelineMember : IEcsProcess
{
EcsPipeline Pipeline { get; set; }
}
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
public interface IEcsSystemDefaultLayer : IEcsProcess
{
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
{
private readonly IConfigContainer _configs;
@ -497,7 +506,7 @@ namespace DCFApixels.DragonECS
#region SystemsLayerMarkerSystem
[MetaTags(MetaTags.HIDDEN)]
[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.")]
public class SystemsLayerMarkerSystem : IEcsProcess
{

View File

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

View File

@ -10,6 +10,8 @@ namespace DCFApixels.DragonECS
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
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
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#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))]
public partial class EcsWorld : IEntityStorage, IEcsMember
{

View File

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

View File

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

View File

@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS.PoolsCore
{
public interface IEcsMember { }
/// <summary>Only used to implement a custom pool. In other contexts use IEcsPool or IEcsPool<T>.</summary>
public interface IEcsPoolImplementation : IEcsPool
{
@ -17,6 +18,7 @@ namespace DCFApixels.DragonECS.PoolsCore
void OnWorldDestroy();
#endregion
}
/// <summary>Only used to implement a custom pool. In other contexts use IEcsPool or IEcsPool<T>.</summary>
/// <typeparam name="T">Component type</typeparam>
public interface IEcsPoolImplementation<T> : IEcsPoolImplementation { }
@ -48,7 +50,10 @@ namespace DCFApixels.DragonECS.PoolsCore
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 static readonly EcsNullPool instance = new EcsNullPool();
@ -136,12 +141,13 @@ namespace DCFApixels.DragonECS.Internal
#endif
#endregion
}
public struct NullComponent { }
}
namespace DCFApixels.DragonECS
{
#region Interfaces
public interface IEcsReadonlyPool
public interface IEcsReadonlyPool : IEcsMember
{
#region Properties
int ComponentTypeID { get; }
@ -165,6 +171,7 @@ namespace DCFApixels.DragonECS
#endregion
#endif
}
public interface IEcsPool : IEcsReadonlyPool
{
#region Methods
@ -174,7 +181,8 @@ namespace DCFApixels.DragonECS
void ClearAll();
#endregion
}
/// <summary>A pool for struct components.</summary>
/// <summary> A pool for struct components. </summary>
public interface IEcsStructPool<T> : IEcsPool where T : struct
{
#region Methods
@ -183,7 +191,8 @@ namespace DCFApixels.DragonECS
ref T Get(int entityID);
#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
{
#region Methods
@ -191,7 +200,8 @@ namespace DCFApixels.DragonECS
T Get(int entityID);
#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
{
#region Methods

View File

@ -10,16 +10,19 @@ using Unity.IL2CPP.CompilerServices;
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 { }
/// <summary> Pool for IEcsTagComponent components. </summary>
#if ENABLE_IL2CPP
[Il2CppSetOption (Option.NullChecks, false)]
#endif
[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.")]
/// <summary>Pool for IEcsTagComponent components</summary>
public sealed class EcsTagPool<T> : IEcsPoolImplementation<T>, IEcsStructPool<T>, IEnumerable<T> //IEnumerable<T> - IntelliSense hack
where T : struct, IEcsTagComponent
{