Пример #1
0
        /// <summary>
        /// 打开UI
        /// </summary>
        /// <param name="UIName">UI名</param>
        /// <param name="callback">动画播放完毕回调</param>
        /// <param name="objs">回调传参</param>`
        /// <returns>返回打开的UI</returns>
        public static UIWindowBase OpenUIWindow(string UIName, UICallBack callback = null, params object[] objs)
        {
            UIWindowBase UIbase = GetHideUI(UIName);

            if (UIbase == null)
            {
                UIbase = CreateUIWindow(UIName);
            }

            RemoveHideUI(UIbase);
            AddUI(UIbase);

            UIStackManager.OnUIOpen(UIbase);
            UILayerManager.SetLayer(UIbase);      //设置层级

            UIbase.windowStatus = UIWindowBase.WindowStatus.OpenAnim;

            UISystemEvent.Dispatch(UIbase, UIEvent.OnOpen);  //派发OnOpen事件
            try
            {
                UIbase.OnOpen(objs);
            }
            catch (Exception e)
            {
                Debug.LogError(UIName + " OnOpen Exception: " + e.ToString());
            }

            UISystemEvent.Dispatch(UIbase, UIEvent.OnOpened); //派发OnOpened事件

            UIAnimManager.StartEnterAnim(UIbase, callback);   //播放动画
            return(UIbase);
        }
Пример #2
0
        public static UIWindowBase HideUI(UIWindowBase ui)
        {
            ui.windowStatus = UIWindowBase.WindowStatus.Hide;
            UISystemEvent.Dispatch(ui, UIEvent.OnHide);  //派发OnHide事件

            try
            {
                ui.Hide();
                ui.OnHide();
            }
            catch (Exception e)
            {
                Debug.LogError(ui.UIName + " OnShow Exception: " + e.ToString());
            }

            return(ui);
        }
Пример #3
0
        static void CloseUIWindowCallBack(UIWindowBase UI, params object[] objs)
        {
            UI.windowStatus = UIWindowBase.WindowStatus.Close;
            UISystemEvent.Dispatch(UI, UIEvent.OnClose);  //派发OnClose事件
            try
            {
                UI.OnClose();
            }
            catch (Exception e)
            {
                Debug.LogError(UI.UIName + " OnClose Exception: " + e.ToString());
            }

            UIStackManager.OnUIClose(UI);
            AddHideUI(UI);

            UISystemEvent.Dispatch(UI, UIEvent.OnClosed);  //派发OnClosed事件
        }
Пример #4
0
        //退出动画播放完毕回调
        public void EndExitAnim(UIWindowBase UIbase, UICallBack callBack, params object[] objs)
        {
            UISystemEvent.Dispatch(UIbase, UIEvent.OnCompleteExitAnim);
            UIbase.OnCompleteExitAnim();
            UIbase.windowStatus = UIWindowBase.WindowStatus.Close;

            try
            {
                if (callBack != null)
                {
                    callBack(UIbase, objs);
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e.ToString());
            }
        }
Пример #5
0
 //开始调用退出动画
 public void StartExitAnim(UIWindowBase UIbase, UICallBack callBack, params object[] objs)
 {
     UISystemEvent.Dispatch(UIbase, UIEvent.OnStartExitAnim);
     StartCoroutine(UIbase.ExitAnim(EndExitAnim, callBack, objs));
 }