Update MetaIDAttribute.cs

This commit is contained in:
DCFApixels 2025-05-18 00:52:07 +08:00
parent 94dc9daa67
commit 90d57539ae

View File

@ -114,28 +114,26 @@ namespace DCFApixels.DragonECS
} }
public static string ParseIDFromTypeName(string name) public static string ParseIDFromTypeName(string name)
{ {
using (StackAllocator.Alloc(name.Length, out char* buffer)) char* buffer = TempBuffer<MetaIDAttribute, char>.Get(name.Length);
int count = 0;
//skip name[0] char
for (int i = 1, iMax = name.Length; i < iMax; i++)
{ {
int count = 0; char current = name[i];
//skip name[0] char if (current == '_')
for (int i = 1, iMax = name.Length; i < iMax; i++)
{ {
char current = name[i]; if (++i >= iMax) { break; }
if (current == '_') current = name[i];
switch (current)
{ {
if (++i >= iMax) { break; } case '1': current = '<'; break;
current = name[i]; case '2': current = '>'; break;
switch (current) case '3': current = ','; break;
{
case '1': current = '<'; break;
case '2': current = '>'; break;
case '3': current = ','; break;
}
} }
buffer[count++] = current;
} }
return new string(buffer, 0, count); buffer[count++] = current;
} }
return new string(buffer, 0, count);
} }
public static string GenerateNewUniqueIDWithAttribute() public static string GenerateNewUniqueIDWithAttribute()