标签:
namespace ObjectType
{
public enum TypeEnum
{
// 主城
B_Castle = 10000,
// 金矿
B_Gold = 10001,
// 伐木场
B_Sawmill = 10002,
}}
using ObjectType;
//将值转换成对应的枚举
for (int i=10000; i<10002; i++) {
TypeEnum mytype= (TypeEnum) Enum.Parse(typeof( TypeEnum),i.ToString());
Debug.Log(mytype);
}
//将枚举转换成对应的值
int test =(int) Enum.Parse (typeof(TypeEnum), TypeEnum.B_ArcherBarracks.ToString ());
标签:
原文地址:http://www.cnblogs.com/huilansehai/p/4238508.html