/// <summary> /// 关闭固定UI /// </summary> public void Close(WindowData windowData) { if (CurrentWindowList != null && CurrentWindowList.Count > 1) { UIWindowBase closeWindow = null; for (int i = 0; i < CurrentWindowList.Count; i++) { if (string.Equals(CurrentWindowList[i].WindowData.Path, windowData.Path)) { closeWindow = CurrentWindowList[i]; } } if (closeWindow != null) { if (windowData.UIType == UIType.Window) { CloseToWindowUIAndTips(closeWindow); } else { closeWindow.Closing(); CurrentWindowList.Remove(closeWindow); closeWindow.gameObject.transform.SetParent(UnEnableUIRoot); closeWindow.Closed(); } } closeWindow = null; CurrentActiveUI = GetTopUIWindow(); if (CurrentActiveUI != null) { CurrentActiveUI.UIReActive(); } } }
/// <summary> /// 展示UI /// </summary> /// <param name="windowData"></param> public void Show(WindowData windowData) { //实例化UI UIWindowBase uiWindowBase = GetCurrentWindowBase(windowData); // 设置UI层级 if (CurrentActiveUI == null || CurrentWindowList.Count <= 0) { uiWindowBase.SetSortOrder(0); } else if (CurrentActiveUI != uiWindowBase) { if (windowData.UIType.Equals(CurrentActiveUI.WindowData.UIType)) { CurrentActiveUI.Closing(); CurrentWindowList.Remove(CurrentActiveUI); CurrentActiveUI.gameObject.transform.SetParent(UnEnableUIRoot); CurrentActiveUI.Closed(); CurrentActiveUI = null; } else { if (windowData.UIType == UIType.Window) { CloseToWindowUIAndTips(uiWindowBase); } } CurrentActiveUI = GetTopUIWindow(); if (CurrentActiveUI != null) { uiWindowBase.SetSortOrder(CurrentActiveUI.MaxSortOrder + 2); } else { uiWindowBase.SetSortOrder(0); } } if (!CurrentWindowList.Contains(uiWindowBase)) { CurrentWindowList.Add(uiWindowBase); } if (!UIWindowDictonary.ContainsKey(windowData.Path)) { UIWindowDictonary.Add(windowData.Path, uiWindowBase); } CurrentActiveUI = uiWindowBase; if (windowData.UIData != null) { CurrentActiveUI.UIInit(windowData.UIData); } else { CurrentActiveUI.UIInit(); } //if (IsBannerShow) //{ // CurrentActiveUI.ShowBanner(BannerType.Top,DPHelper.GetBannerHeightPixel()); //} //else //{ // CurrentActiveUI.CloseBanner(); //} }