public void PopPanel() { if (panelStack.Count <= 0) { return; } BasePanel topPanel = panelStack.Pop(); topPanel.SetActiveUI(false); if (panelStack.Count <= 0) { return; } BasePanel topPanel2 = panelStack.Peek(); topPanel.SetActiveUI(true); }
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); }