public void Prev() { //if (ListUIPanel.Count < 2) //{ // OnPopupToastPanel("숨겨진 패널이 없습니다"); // return; //} UIBasePanel hidePanel = null; UIBasePanel showPanel = null; int hideIdx = ListUIPanel.FindIndex(panel => panel._ePanelType != ePanelState.Ignore && _CurUIBasePanel.name == panel.name); if (hideIdx >= 0 && ListUIPanel.Count > hideIdx) { hidePanel = ListUIPanel[hideIdx]; } // 뒤로 가기 막기 if (hidePanel is InGameHUDPanel) { return; } if (hidePanel is MainPanel || hidePanel is TitlePanel) { OpenPopup(DataMgr.Instance.GetLocal(5), DataMgr.Instance.GetLocal(6), delegate() { Application.Quit(); }, delegate() { }, DataMgr.Instance.GetLocal(3), DataMgr.Instance.GetLocal(4)); return; } int showIdx = ListUIPanel.FindIndex(hideIdx + 1, panel => panel._ePanelType != ePanelState.Ignore); if (showIdx >= 0 && ListUIPanel.Count > showIdx) { showPanel = ListUIPanel[showIdx]; } if (hidePanel != null) { switch (hidePanel.Prev()) { case PrevType.Not: break; case PrevType.OnlyHide: { hidePanel.Hide(); } break; case PrevType.Hide: { if (showPanel != null) { _CurUIBasePanel = showPanel; showPanel.LateInit(); } hidePanel.Hide(); } break; case PrevType.OnlyClose: { hidePanel.Close(); } break; case PrevType.Close: { if (showPanel != null) { _CurUIBasePanel = showPanel; showPanel.LateInit(); } hidePanel.Close(); } break; } } }
/* * /// <summary> * /// 모든 UI OFF * /// </summary> * static public void UIShutDown() * { * List<UIBasePanel> Panels = UIMgr.instance.FindAllInShowing<UIBasePanel>(); * foreach (UIBasePanel panel in Panels) * { * if (panel.ShowOption == ShowOption.Ignore) * continue; * * if (panel.Popup) * continue; * * panel.Hide(); * } * } */ /// <summary> /// 안드로이드, PC에서 뒤로가기 처리함수. /// 아직 좀더 만져줘야함. 주석처리 되어 있는건 기존의 것.(아직 삭제하면 않이됩니다.) /// 사용 방식은 PrevReturnType에 맞게 Close, Hide를 호출함. Not일 경우 ShowingPanels등록되어 있는거 삭제만함. /// 설정은 코드에서 Prev재정의 하거나, Prefab에서 변경해주면됨. /// </summary> public void Prev(int depth = 1) { if (SceneManager.instance.IsShowStaticUI) { return; } for (int i = 0; i < depth; ++i)//depth는 무조건 1일 것이다. { int hideIdx = ShowingPanels.FindIndex(i, (basePanel) => basePanel.ShowOption != ShowOption.Ignore); if (hideIdx < 0)//-1 값이 나올 경우가 존제함. 예외처리. { continue; } UIBasePanel curPanel = ShowingPanels[hideIdx]; if (!curPanel.gameObject.activeSelf) { if (depth == 1) { depth += 1; } continue; } /* * if (curPanel.name.Contains("TownPanel") || curPanel.name.Contains("LoginPanel") )//(EndPanel != null && EndPanel == ShowingPanels[hideIdx]) * { * //시스템 종료 팝업 * AddPopup(2, Application.Quit, null, null); * return; * } */ //< 뒤로가기가 가능할시에만 처리 //HideEvent, CloseEvent 함수에서 삭제 함수 호출함. 독특한 예외처리 필요치 않는 이상 신경안써도 됨. UIBasePanel hidePanel = ShowingPanels[hideIdx]; switch (hidePanel.Prev()) { //< 숨기기만 해줌 case PrevReturnType.None: case PrevReturnType.Hide: hidePanel.Hide(); break; case PrevReturnType.Close: hidePanel.Close(); break; case PrevReturnType.Quit: if (hidePanel.Quit()) { #if UNITY_EDITOR { AddPopup(75, 74, 117, 76, 0, () => { UnityEditor.EditorApplication.isPlaying = false; }); } #else AddPopup(75, 74, 117, 76, 0, () => { Application.Quit(); }); #endif } break; } } }