mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-17 17:34:36 +08:00
rename MetaGroup
This commit is contained in:
parent
394820549f
commit
e0a3d54979
@ -193,32 +193,32 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#region GetGroup
|
||||
public static ReadonlyMetaGroup GetGroup(object obj)
|
||||
public static MetaGroup GetGroup(object obj)
|
||||
{
|
||||
return GetTypeMeta(obj).Group;
|
||||
}
|
||||
public static ReadonlyMetaGroup GetGroup<T>()
|
||||
public static MetaGroup GetGroup<T>()
|
||||
{
|
||||
return GetTypeMeta<T>().Group;
|
||||
}
|
||||
public static ReadonlyMetaGroup GetGroup(Type type)
|
||||
public static MetaGroup GetGroup(Type type)
|
||||
{
|
||||
return GetTypeMeta(type).Group;
|
||||
}
|
||||
|
||||
public static bool TryGetGroup(object obj, out ReadonlyMetaGroup group)
|
||||
public static bool TryGetGroup(object obj, out MetaGroup group)
|
||||
{
|
||||
TypeMeta meta = GetTypeMeta(obj);
|
||||
group = meta.Group;
|
||||
return group.IsNull;
|
||||
}
|
||||
public static bool TryGetGroup<T>(out ReadonlyMetaGroup group)
|
||||
public static bool TryGetGroup<T>(out MetaGroup group)
|
||||
{
|
||||
TypeMeta meta = GetTypeMeta<T>();
|
||||
group = meta.Group;
|
||||
return group.IsNull;
|
||||
}
|
||||
public static bool TryGetGroup(Type type, out ReadonlyMetaGroup group)
|
||||
public static bool TryGetGroup(Type type, out MetaGroup group)
|
||||
{
|
||||
TypeMeta meta = GetTypeMeta(type);
|
||||
group = meta.Group;
|
||||
@ -313,7 +313,7 @@ namespace DCFApixels.DragonECS
|
||||
public string Name { get; }
|
||||
public MetaColor Color { get; }
|
||||
public string Description { get; }
|
||||
public ReadonlyMetaGroup Group { get; }
|
||||
public MetaGroup Group { get; }
|
||||
public IReadOnlyCollection<string> Tags { get; }
|
||||
}
|
||||
public sealed class TypeMeta : ITypeMeta
|
||||
@ -327,7 +327,7 @@ namespace DCFApixels.DragonECS
|
||||
private string _name;
|
||||
private MetaColor _color;
|
||||
private string _description;
|
||||
private ReadonlyMetaGroup _group;
|
||||
private MetaGroup _group;
|
||||
private IReadOnlyCollection<string> _tags;
|
||||
private int _typeCode;
|
||||
|
||||
@ -417,7 +417,7 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#region Group
|
||||
public ReadonlyMetaGroup Group
|
||||
public MetaGroup Group
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -547,9 +547,9 @@ namespace DCFApixels.DragonECS.Internal
|
||||
#endregion
|
||||
|
||||
#region GetGroup
|
||||
public static ReadonlyMetaGroup GetGroup(Type type)
|
||||
public static MetaGroup GetGroup(Type type)
|
||||
{
|
||||
return type.TryGetCustomAttribute(out MetaGroupAttribute atr) ? atr.Data : ReadonlyMetaGroup.Empty;
|
||||
return type.TryGetCustomAttribute(out MetaGroupAttribute atr) ? atr.Data : MetaGroup.Empty;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -6,15 +6,15 @@ namespace DCFApixels.DragonECS
|
||||
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class MetaGroupAttribute : EcsMetaAttribute
|
||||
{
|
||||
public readonly MetaGroup Data;
|
||||
public readonly MetaGroupRef Data;
|
||||
public MetaGroupAttribute(string name)
|
||||
{
|
||||
Data = new MetaGroup(name);
|
||||
Data = new MetaGroupRef(name);
|
||||
}
|
||||
}
|
||||
public class MetaGroup
|
||||
public class MetaGroupRef
|
||||
{
|
||||
public static readonly MetaGroup Empty = new MetaGroup("");
|
||||
public static readonly MetaGroupRef Empty = new MetaGroupRef("");
|
||||
|
||||
public readonly string Name;
|
||||
private string[] path = null;
|
||||
@ -29,7 +29,7 @@ namespace DCFApixels.DragonECS
|
||||
return path;
|
||||
}
|
||||
}
|
||||
public MetaGroup(string name)
|
||||
public MetaGroupRef(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
@ -45,10 +45,10 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
}
|
||||
|
||||
public readonly struct ReadonlyMetaGroup
|
||||
public readonly struct MetaGroup
|
||||
{
|
||||
public static readonly ReadonlyMetaGroup Empty = new ReadonlyMetaGroup(MetaGroup.Empty);
|
||||
private readonly MetaGroup _source;
|
||||
public static readonly MetaGroup Empty = new MetaGroup(MetaGroupRef.Empty);
|
||||
private readonly MetaGroupRef _source;
|
||||
public string Name
|
||||
{
|
||||
get { return _source.Name; }
|
||||
@ -61,14 +61,14 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
get { return _source == null; }
|
||||
}
|
||||
public ReadonlyMetaGroup(MetaGroup source)
|
||||
public MetaGroup(MetaGroupRef source)
|
||||
{
|
||||
_source = source;
|
||||
}
|
||||
|
||||
public static implicit operator ReadonlyMetaGroup(MetaGroup group)
|
||||
public static implicit operator MetaGroup(MetaGroupRef group)
|
||||
{
|
||||
return new ReadonlyMetaGroup(group);
|
||||
return new MetaGroup(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user