Entitas
This commit is contained in:
ALEXTANG
2023-07-17 15:28:27 +08:00
parent 31d4d6c0b8
commit a273e9d5f8
64 changed files with 994 additions and 13 deletions

View File

@@ -0,0 +1,30 @@
using System;
namespace TEngine
{
public static class EnumHelper
{
public static int EnumIndex<T>(int value)
{
int i = 0;
foreach (object v in Enum.GetValues(typeof (T)))
{
if ((int) v == value)
{
return i;
}
++i;
}
return -1;
}
public static T FromString<T>(string str)
{
if (!Enum.IsDefined(typeof(T), str))
{
return default(T);
}
return (T)Enum.Parse(typeof(T), str);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2638994be90d44a583fe978f8b92664d
timeCreated: 1689578753