mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-11-13 17:15:54 +08:00
update MetaGroup
This commit is contained in:
parent
c73d660f13
commit
fd5d1ec06a
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
@ -7,10 +8,17 @@ namespace DCFApixels.DragonECS
|
|||||||
public sealed class MetaGroupAttribute : EcsMetaAttribute
|
public sealed class MetaGroupAttribute : EcsMetaAttribute
|
||||||
{
|
{
|
||||||
public readonly MetaGroupRef Data;
|
public readonly MetaGroupRef Data;
|
||||||
|
|
||||||
|
[Obsolete("With empty parameters, this attribute makes no sense.")]
|
||||||
|
public MetaGroupAttribute() { }
|
||||||
public MetaGroupAttribute(string name)
|
public MetaGroupAttribute(string name)
|
||||||
{
|
{
|
||||||
Data = new MetaGroupRef(name);
|
Data = new MetaGroupRef(name);
|
||||||
}
|
}
|
||||||
|
public MetaGroupAttribute(params string[] path)
|
||||||
|
{
|
||||||
|
Data = new MetaGroupRef(string.Join('/', path));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class MetaGroupRef
|
public class MetaGroupRef
|
||||||
{
|
{
|
||||||
@ -18,6 +26,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
private string[] path = null;
|
private string[] path = null;
|
||||||
|
private static string pattern = @"Module(?=/)";
|
||||||
public IReadOnlyCollection<string> Splited
|
public IReadOnlyCollection<string> Splited
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -41,7 +50,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
name += '/';
|
name += '/';
|
||||||
}
|
}
|
||||||
Name = name;
|
Name = Regex.Replace(name, pattern, ""); ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user