/// <summary>
 /// 在目标层下方
 /// </summary>
 private void InsertTargetLayerDown(UIWindowBase targetUIWindow)
 {
     if (targetUIWindow != null)
     {
         int targetLayer = targetUIWindow.SortOrder;
         for (int i = 0; i < HiUIManager.Instance.CurrentWindowList.Count; i++)
         {
             if (HiUIManager.Instance.CurrentWindowList[i].SortOrder >= targetLayer)
             {
                 HiUIManager.Instance.CurrentWindowList[i].MoveLayerToUp();
             }
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// 获取最上层的 Type 为 Windown 的 UI
        /// </summary>
        /// <returns></returns>
        private UIWindowBase GetTopWindow()
        {
            UIWindowBase topWindow = null;

            for (int i = 0; i < CurrentWindowList.Count; i++)
            {
                if (CurrentWindowList[i].WindowData != null && CurrentWindowList[i].WindowData.UIType == UIType.Window)
                {
                    if (topWindow == null || topWindow.SortOrder <= CurrentWindowList[i].SortOrder)
                    {
                        topWindow = CurrentWindowList[i];
                    }
                }
            }
            return(topWindow);
        }
Exemple #3
0
 public UIWindowBase GetWindow(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];
                 return(closeWindow);
             }
         }
     }
     return(null);
 }
Exemple #4
0
 /// <summary>
 /// 获取需要激活曾
 /// </summary>
 /// <returns></returns>
 private UIWindowBase GetRequireWindowBase(WindowData windowData)
 {
     if (CurrentWindowList != null && CurrentWindowList.Count > 1)
     {
         UIWindowBase uIWindowBase = null;
         for (int i = 0; i < CurrentWindowList.Count; i++)
         {
             if (CurrentWindowList[i].SortOrder < CurrentActiveUI.SortOrder)
             {
                 if (uIWindowBase == null || uIWindowBase.SortOrder < CurrentWindowList[i].SortOrder)
                 {
                     uIWindowBase = CurrentWindowList[i];
                 }
             }
         }
         return(uIWindowBase);
     }
     return(null);
 }
Exemple #5
0
        /// <summary>
        /// 跳转到别的WindowUI
        /// </summary>
        private void CloseToWindowUIAndTips(UIWindowBase uiWindowBase)
        {
            UIWindowBase topWindow = GetTopWindow();

            if (topWindow != null)
            {
                List <UIWindowBase> closeList = GetCloseWindowList(topWindow.Canvas.sortingOrder);
                closeList.Add(topWindow);
                for (int i = 0; i < closeList.Count; i++)
                {
                    //关闭不等于自己的Window
                    if (!string.Equals(closeList[i].WindowData.Path, uiWindowBase.WindowData.Path))
                    {
                        closeList[i].Closing();
                        CurrentWindowList.Remove(closeList[i]);
                        closeList[i].gameObject.transform.SetParent(UnEnableUIRoot);
                        closeList[i].Closed();
                    }
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// 获取最下层UI
        /// </summary>
        /// <param name="CurrentWindowList"></param>
        /// <returns></returns>
        internal UIWindowBase GetBottomUIWindow()
        {
            UIWindowBase uIWindowBase = null;

            if (CurrentWindowList != null && CurrentWindowList.Count > 0)
            {
                for (int i = 0; i < CurrentWindowList.Count; i++)
                {
                    if (uIWindowBase == null)
                    {
                        uIWindowBase = CurrentWindowList[i];
                    }
                    else
                    {
                        if (uIWindowBase.SortOrder > CurrentWindowList[i].SortOrder)
                        {
                            uIWindowBase = CurrentWindowList[i];
                        }
                    }
                }
            }
            return(uIWindowBase);
        }
Exemple #7
0
        /// <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();
            //}
        }