//---------------------------------------------------------------------------- private string GetTypeName(eUIGMMainType type) { switch (type) { case eUIGMMainType.Res: return("资源"); case eUIGMMainType.Battle: return("战斗"); case eUIGMMainType.Native: return("原生"); case eUIGMMainType.Log: return("日志"); case eUIGMMainType.Login: return("登录"); case eUIGMMainType.Other: return("其他"); case eUIGMMainType.Guide: return("引导"); case eUIGMMainType.Scenario: return("剧情"); default: return(type.ToString()); } }
//---------------------------------------------------------------------------- private void AddBtn(eUIGMMainType type, string name, Action act, Vector2 pos = default) { UIGMMainInfo info = new UIGMMainInfo { name = name, action = act, pos = pos }; GetInfoList(type).Add(info); }
//---------------------------------------------------------------------------- private List <UIGMMainInfo> GetInfoList(eUIGMMainType type) { if (!m_infoDict.ContainsKey(type)) { m_infoDict.Add(type, new List <UIGMMainInfo>()); } return(m_infoDict[type]); }
//---------------------------------------------------------------------------- private void ShowPanel(eUIGMMainType type) { if (m_view == null) { m_view = new UIGMMainView(); } if (m_infoDict.ContainsKey(type)) { m_view.ShowList(m_infoDict[type]); } }
//---------------------------------------------------------------------------- private void InitList() { AddBtn(eUIGMMainType.Main, "Close", Close); for (int i = 0; i < (int)eUIGMMainType.Count; i++) { eUIGMMainType type = (eUIGMMainType)i; if (type == eUIGMMainType.Login) { AddBtn(eUIGMMainType.Main, "快速登录", FastLogin); } else { AddBtn(eUIGMMainType.Main, GetTypeName(type), () => ShowPanel(type)); AddBtn(type, "Back", () => ShowPanel(eUIGMMainType.Main)); } } AddBtn(eUIGMMainType.Log, "屏幕日志", ScreenLog); }