定义枚举类型
public enum UIPanelType {
ItemMessage,
Knapsack,
MainMenu,
Shop,
Skill,
System,
Task
}
输入字符串,转为枚举类型的值
System.Enum.Parse(typeof(enum..), str);
public void OnPushPanel(string panelTypeString)
{
UIPanelType panelType = (UIPanelType) System.Enum.Parse(typeof(UIPanelType), panelTypeString);
UIManager.Instance.PushPanel(panelType);
}