遍历枚举

public enum GestureTypes

{

SwipingLeft,

SwipingRight,

SwipingUp,

SwipingDown,

ThumbUp,

ThumbDown,

Fist,

FaceUp,

FaceDown,

ClapHand,

Grab,

Throw

}


foreach (GestureTypes type in Enum.GetValues(typeof(GestureTypes)))

 {                       

 if (t.name.Equals (type.ToString ()))                      

  {                           

 print(t.name);                            

print(type.ToString());                            

_listActiveGestures.Add(type, t.GetComponent() as object);

}

}

你可能感兴趣的:(遍历枚举)