Esempio n. 1
0
        /// <summary>
        /// 打开一个UI
        /// </summary>
        /// <param name="uiId"></param>
        /// <param name="useAnim"></param>
        /// <param name="closeCurrentStackUI">是否关闭上一个入栈的UI</param>
        /// <returns></returns>
        public BaseUI OpenUI(object uiId, bool useAnim = true, bool closeCurrentStackUI = true)
        {
            BaseUI ui = GetUI(uiId);

            if (ui == null)
            {
                Debug.Log(uiId + "UI未注册");
            }
            else
            {
                if (ui.uiType == BaseUI.UiType.PANEL_STACK)
                {
                    if (uiStack.Count > 0)
                    {
                        object preUiId = PopStack();
                        BaseUI preUi   = GetUI(preUiId);
                        if (preUi != null)
                        {
                            PushStack(preUiId);
                            //关闭上一个入栈的UI
                            if (closeCurrentStackUI)
                            {
                                CloseAUI(preUi, useAnim);
                            }
                            else
                            {
                                preUi.OutActive();
                            }
                        }
                    }
                    //入栈一个Panel_Stack类型的UI
                    PushStack(uiId);
                }
                OpenAUI(ui, useAnim);
            }
            return(ui);
        }
Esempio n. 2
0
 private void CloseAUI(BaseUI ui, bool useAnim)
 {
     ui.OutActive();
     ui.Close(useAnim);
 }