예제 #1
0
        /// <summary>
        /// 打开一个弹窗界面
        /// </summary>
        /// <param name="popupOperate"></param>
        /// <param name="belongPageView">当前弹窗属于哪个Page 管理 ,如果=null则表示属于当前打开的界面 否则指定的参数界面 </param>
        /// <param name="isFailRecord">如果是因为优先级而无法弹出 则表示是否需要记录 如果为false 则当无法显示时候不会自动弹出,而是隐藏了</param>
        /// <param name="parameter"></param>
        ///
        public void OpenPopUp(PopupOpenOperateEnum popupOperate, UIBasePageView belongPageView, bool isFailRecord, UIParameterArgs parameter)
        {
            if (parameter == null)
            {
                Debug.LogError("parameter 不要使用null  使用默认的 UIParameterArgs.Create() 无参数方法替代");
                return;
            }
#if UNITY_EDITOR
            if (this.WindowType != WindowTypeEnum.PopUp)
            {
                Debug.LogError("OpenPopUp Fail,Not Popup Window " + this.name);
                return;
            }
#endif
            Dictionary <int, UIBasePopupView> allWillHidePopupView = GetWillHidePopupView(this, popupOperate, isFailRecord, parameter);
            foreach (var item in allWillHidePopupView)
            {
                item.Value.HideWindow(UIParameterArgs.Create());
                m_AllRecordViewPopup.RemoveAt(item.Key);
            }
            if (belongPageView == null)
            {
                belongPageView = UIBasePageView.CurOpenPage;
            }

            UIParameterArgs args0 = UIParameterArgs.Create(belongPageView, isFailRecord);
            this.ShowWindow(Helper.Instance.MegerUIParameter(args0, parameter)); //注意这里的第一个参数
            m_AllRecordViewPopup.Add(this);
        }
예제 #2
0
 /// <summary>
 /// 关闭一个页面所有关联的Popup /Widget
 /// </summary>
 /// <param name="view"></param>
 private void ClosePageConnectView(UIBasePageView view)
 {
     if (view != null)
     {
         view.HideWindow(UIParameterArgs.Create());
         UIBasePopupView.RemoveWillPopupView(view);                                           //关闭当前界面所包含的弹窗(没有弹出的)
         UIBasePopupView.CloseConnectPopupView(view);                                         //关闭当前界面所包含的弹窗 (已经弹出的)
         UIBaseWidgetView.CloseAttachWidget(view.transform, false, UIParameterArgs.Create()); //关闭关联的Widget
     }
 }
예제 #3
0
 /// <summary>
 /// 关闭页面时候关闭这个页面所包含的没有弹出的弹窗
 /// </summary>
 /// <param name="pageview"></param>
 public static void RemoveWillPopupView(UIBasePageView pageview)
 {
     if (pageview == null)
     {
         Debug.LogError("RemoveWillPopupView Is Null Page");
         return;
     }
     if (m_LowerPriorityPopupView.ContainsKey(pageview) == false)
     {
         return;
     }
     m_LowerPriorityPopupView[pageview].Clear();
 }
예제 #4
0
        /// <summary>
        /// 关闭页面时候 关闭关联的已经打开的弹窗
        /// </summary>
        /// <param name="pageview"></param>
        public static void CloseConnectPopupView(UIBasePageView belongPageView)
        {
            if (belongPageView == null)
            {
                Debug.LogError("ClosePopupView Is Null Page");
                return;
            }

            for (int dex = m_AllRecordViewPopup.Count - 1; dex >= 0; --dex)
            {
                if (m_AllRecordViewPopup[dex].BelongPageView == belongPageView)
                {
                    m_AllRecordViewPopup[dex].HideWindow(UIParameterArgs.Create());
                    m_AllRecordViewPopup.RemoveAt(dex);
                }
            }
        }
예제 #5
0
        //public static void CloseAllPopupView()
        //{
        //    Debug.LogEditorInfor("TODO...");
        //}



        /// <summary>
        /// 记录需要弹出来的窗口
        /// </summary>
        /// <param name="pageview"></param>
        /// <param name="popupView"></param>
        private void RecordWillPopupView(UIBasePageView pageview, UIBasePopupView popupView)
        {
            if (pageview == null || popupView == null)
            {
                Debug.LogError("RecordWillPopupView Fail " + (pageview == null) + " ::" + (popupView == null));
                return;
            }

            if (m_LowerPriorityPopupView.ContainsKey(pageview) == false)
            {
                List <UIBasePopupView> pagePopupView = new List <UIBasePopupView>();
                pagePopupView.Add(popupView);
                m_LowerPriorityPopupView.Add(pageview, pagePopupView);
            }
            else
            {
                m_LowerPriorityPopupView[pageview].Add(popupView);

#if UNITY_EDITOR
                Debug.LogEditorInfor("排序前的顺序");
                for (int dex = 0; dex < m_LowerPriorityPopupView[pageview].Count; ++dex)
                {
                    Debug.LogEditorInfor("dex={0}   popupView={1 }   priority={2}", dex, m_LowerPriorityPopupView[pageview][dex], m_LowerPriorityPopupView[pageview][dex].Priority);
                }
#endif

                SortPopupViewByPriority(m_LowerPriorityPopupView[pageview]); //  //按照优先级从低到高排序
                //m_LowerPriorityPopupView[pageview].Sort((a, b) =>
                //{
                //    if (a.Priority > b.Priority)
                //        return 1;
                //    else if (a.Priority == b.Priority)
                //        return 0;
                //    else return -1;
                //});   //按照优先级从低到高排序

#if UNITY_EDITOR
                Debug.LogEditorInfor("排序后的顺序");
                for (int dex = 0; dex < m_LowerPriorityPopupView[pageview].Count; ++dex)
                {
                    Debug.LogEditorInfor("dex={0}   popupView={1 }   priority={2}", dex, m_LowerPriorityPopupView[pageview][dex], m_LowerPriorityPopupView[pageview][dex].Priority);
                }
#endif
            }
        }
예제 #6
0
        /// <summary>
        /// 关闭当前打开的界面 自动打开上一个Page界面
        /// </summary>
        /// <param name="view"></param>
        /// <param name="parameter"></param>
        public void ClosePage(UIParameterArgs CloseParameter, UIParameterArgs openPageParameter)
        {
            if (CurOpenPage == null)
            {
                return;
            }
            if (CloseParameter == null)
            {
                Debug.LogError("parameter 不要使用null  使用默认的 UIParameterArgs.Create() 无参数方法替代");
                return;
            }
#if UNITY_EDITOR
            if (m_AllRecordViewPage.Count == 0 || m_AllRecordViewPage[m_AllRecordViewPage.Count - 1] != CurOpenPage)
            {
                Debug.LogEditorInfor("ClosePage  Fail, " + (m_AllRecordViewPage.Count == 0));
                return;
            }
#endif

            if (CurOpenPage != this)
            {
                return;                      //同时只有一个界面时候想关闭的一定是最后一个界面
            }
            //if (m_AllRecordViewPage.Count == 1)
            //{
            //    Debug.LogError("只剩下一个界面 无法关闭" + CurOpenPage.name);
            //    return;
            //}

            HideWindow(CloseParameter);
            m_AllRecordViewPage.Remove(this); //移除当前页面
            if (m_AllRecordViewPage.Count > 0)
            {
                CurOpenPage = m_AllRecordViewPage[m_AllRecordViewPage.Count - 1];
                CurOpenPage.ShowWindow(openPageParameter);
            } //在打开另一个界面时候回关闭当前界面
            else
            {
                m_AllRecordViewPage.Clear();
                ClosePageConnectView(CurOpenPage);
                CurOpenPage = null;
            } //关闭最后一个页面
        }
예제 #7
0
        /// <summary>
        /// 打开一个页面UI
        /// </summary>
        /// <typeparam name="T"></typeparam>
        public void OpenPage(UIParameterArgs parameter)
        {
            if (parameter == null)
            {
                Debug.LogError("parameter 不要使用null  使用默认的 UIParameterArgs.Create() 无参数方法替代");
                return;
            }

#if UNITY_EDITOR
            if (this.WindowType != WindowTypeEnum.Page)
            {
                Debug.LogError("OpenPage Fail,Not Page Window " + this.name);
                return;
            }
#endif

            if (m_AllRecordViewPage.Contains(this) == false)
            {
                #region 打开一个新的页面
                m_AllRecordViewPage.Add(this);
                ClosePageConnectView(CurOpenPage);

                //if (CurOpenPage != null)
                //{
                //    CurOpenPage.HideWindow();
                //    RemoveWillPopupView(CurOpenPage);  //关闭当前界面所包含的弹窗
                //    CloseAttachWidget(CurOpenPage.transform,false);   //关闭关联的Widget
                //}
                CurOpenPage = this;  //更新当前打开的窗口
                this.ShowWindow(parameter);
                #endregion
                return;
            }

            #region 打开一个已经打开过的页面
            Debug.Log("界面已经被打开过 则需要处理");
            if (this == CurOpenPage)
            {
                CurOpenPage.ShowWindow(parameter);
                //#region 当前要打开的界面就是最后打开的页面   则根据条件判断是否只需要刷新
                //if (CurOpenPage.IsActivate && CurOpenPage.IsShowingWindow && CurOpenPage.IsCompleteShow)
                //{
                //    Debug.Log("界面已经打开了  执行刷新操作 ");
                //    CurOpenPage.ShowWindow(parameter);
                //}
                //else
                //{
                //    Debug.LogError("当前界面状态异常 正在打开中..... " + CurOpenPage.IsShowingWindow + ":" + CurOpenPage.IsCompleteShow);
                //}
                //#endregion
                return;
            }//当前要打开的界面就是最后打开的页面   则根据条件判断是否只需要刷新

            #region  弹出已经打开过的界面 并记录当前页面
            //if (CurOpenPage != null)
            //{
            //    CurOpenPage.HideWindow();
            //    RemoveWillPopupView(CurOpenPage);  //关闭当前界面所包含的弹窗
            //    CloseAttachWidget(CurOpenPage.transform, false);   //关闭关联的Widget
            //}
            ClosePageConnectView(CurOpenPage);

            for (int dex = m_AllRecordViewPage.Count - 1; dex >= 0; --dex)
            {
                if (m_AllRecordViewPage[dex] != this)
                {
                    m_AllRecordViewPage.RemoveAt(dex);
                }
            } //弹出已经打开过的界面
            CurOpenPage = this;
            m_AllRecordViewPage.Add(this);
            this.ShowWindow(parameter);
            #endregion

            #endregion
        }