public void PushPanel(UIPanelType uiPanelType) { if (panelStack.Count > 0) { BasePanel topPanel = panelStack.Peek(); //topPanel.SetActiveUI(false); } BasePanel panel = GetPanel(uiPanelType); panel.SetActiveUI(true); panelStack.Push(panel); }
private BasePanel GetPanel(UIPanelType uiPanelType) { BasePanel panel = null; if (!panelDic.ContainsKey(uiPanelType)) { string path = "UiPanels/" + uiPanelType.ToString(); GameObject g = Resources.Load(path) as GameObject; GameObject go = Instantiate(g); panel = go.GetComponent <BasePanel>(); panel.transform.SetParent(this.transform); panel.SetActiveUI(false); panelDic.Add(uiPanelType, panel); return(panel); } panel = panelDic[uiPanelType]; return(panel); }