update debug

This commit is contained in:
Mikhail 2024-02-28 02:10:35 +08:00
parent 8b0cd12403
commit 6fcad52300
7 changed files with 16 additions and 6 deletions

View File

@ -384,6 +384,10 @@ namespace DCFApixels.DragonECS
#endregion
#region GetCachedTypeMeta
public static TypeMetaDataCached GetMeta(this object self)
{
return GetCachedTypeMeta(self);
}
private static readonly Dictionary<Type, TypeMetaDataCached> _metaCache = new Dictionary<Type, TypeMetaDataCached>();
public static TypeMetaDataCached GetCachedTypeMeta(object obj)
{

View File

@ -0,0 +1,6 @@
using System;
namespace DCFApixels.DragonECS
{
public abstract class EcsMetaAttribute : Attribute { }
}

View File

@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
namespace DCFApixels.DragonECS
{
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
public sealed class MetaColorAttribute : Attribute
public sealed class MetaColorAttribute : EcsMetaAttribute
{
public readonly MetaColor color;
public byte R => color.r;

View File

@ -3,7 +3,7 @@
namespace DCFApixels.DragonECS
{
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
public sealed class MetaDescriptionAttribute : Attribute
public sealed class MetaDescriptionAttribute : EcsMetaAttribute
{
public readonly string description;
public MetaDescriptionAttribute(string description) => this.description = description;

View File

@ -4,7 +4,7 @@ using System.Text.RegularExpressions;
namespace DCFApixels.DragonECS
{
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
public sealed class MetaGroupAttribute : Attribute
public sealed class MetaGroupAttribute : EcsMetaAttribute
{
public static readonly MetaGroupAttribute Empty = new MetaGroupAttribute("");
public readonly string name;

View File

@ -3,7 +3,7 @@
namespace DCFApixels.DragonECS
{
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
public sealed class MetaNameAttribute : Attribute
public sealed class MetaNameAttribute : EcsMetaAttribute
{
public readonly string name;
public MetaNameAttribute(string name) => this.name = name;

View File

@ -5,9 +5,9 @@ using System.Linq;
namespace DCFApixels.DragonECS
{
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
public sealed class MetaTagsAttribute : Attribute
public sealed class MetaTagsAttribute : EcsMetaAttribute
{
private readonly string[] _tags;
private readonly string[] _tags = Array.Empty<string>();
public IReadOnlyCollection<string> Tags => _tags;
[Obsolete("With empty parameters, this attribute makes no sense.", true)]