public bool HasShow_PopPanel(MG_PopPanelType _PopPanelType) { int panelIndex = (int)_PopPanelType; if (LoadedPanel_Dic.ContainsKey(panelIndex)) { if (Panel_Stack.Contains(LoadedPanel_Dic[panelIndex])) { return(true); } } return(false); }
public void ClosePopPanelAsync(MG_PopPanelType _PopPanelType) { PanelTask newTask = new PanelTask() { t_panelType = _PopPanelType, t_open = false }; Queue_PopPanel.Enqueue(newTask); if (Cor_PopPanelTask is null) { Cor_PopPanelTask = StartCoroutine(ExcuteTask()); } }
public bool ClosePopPanel(MG_PopPanelType _PanelType) { int panelIndex = (int)_PanelType; if (LoadedPanel_Dic.TryGetValue(panelIndex, out MG_UIBase loadedPopPanel)) { if (loadedPopPanel is null) { LoadedPanel_Dic.Remove(panelIndex); Debug.LogWarning("Close MG_PopPanel-" + _PanelType + " Error : loadedDic has key , but content is null."); return(false); } if (Panel_Stack.Contains(loadedPopPanel)) { while (true) { if (Panel_Stack.Count > 0) { MG_UIBase outPanel = Panel_Stack.Pop(); outPanel.OnExit(); if (Panel_Stack.Count > 0) { Panel_Stack.Peek().OnResume(); } if (outPanel == loadedPopPanel) { break; } } else { break; } } } else { Debug.LogWarning("Close MG_PopPanel-" + _PanelType + " Error : panel has not show."); return(false); } } else { Debug.LogWarning("Close MG_PopPanel-" + _PanelType + " Error : panel has not show."); return(false); } return(true); }
public bool ShowPopPanel(MG_PopPanelType _PanelType) { int panelIndex = (int)_PanelType; if (LoadedPanel_Dic.TryGetValue(panelIndex, out MG_UIBase loadedPopPanel)) { if (loadedPopPanel is null) { LoadedPanel_Dic.Remove(panelIndex); Debug.LogWarning("Show MG_PopPanel-" + _PanelType + " Error : loadedDic has key , but content is null."); return(false); } else { if (Panel_Stack.Contains(loadedPopPanel)) { Debug.LogWarning("Show MG_PopPanel-" + _PanelType + " Error : panel has showed."); return(false); } else { if (Panel_Stack.Count > 0) { Panel_Stack.Peek().OnPause(); } loadedPopPanel.transform.SetAsLastSibling(); Panel_Stack.Push(loadedPopPanel); loadedPopPanel.OnEnter(); } } } else { if (Type_Path_Dic.TryGetValue(panelIndex, out string panelPath)) { if (string.IsNullOrEmpty(panelPath)) { Debug.LogWarning("Show MG_PopPanel-" + _PanelType + " Error : panelPathDic content is null or empty."); return(false); } else { MG_UIBase nextShowPanel = Instantiate(Resources.Load <GameObject>(panelPath), PopPanelRoot).GetComponent <MG_UIBase>(); if (Panel_Stack.Count > 0) { Panel_Stack.Peek().OnPause(); } nextShowPanel.transform.SetAsLastSibling(); Panel_Stack.Push(nextShowPanel); LoadedPanel_Dic.Add(panelIndex, nextShowPanel); nextShowPanel.OnEnter(); } } else { Debug.LogWarning("Show MG_PopPanel-" + _PanelType + " Error : panelPathDic content is null or empty."); return(false); } } return(true); }
public void ShowPopPanel(MG_PopPanelType _PopPanelType) { MG_UIManager.Instance.ShowPopPanelAsync(_PopPanelType); }