Ejemplo n.º 1
0
        /// <summary>
        /// 打开UI
        ///
        /// 加载指定名称的UI窗体预设到内存中,对不同显示类型的窗体做不同处理
        /// </summary>
        /// <param name="uiType">ui窗体的类型</param>
        /// <returns></returns>
        public BaseUIForms ShowUIForms(Type uiType)
        {
            //根据UI窗体名称,将预设加载到“所有窗体”的缓存集合中
            BaseUIForms baseUIForms = this.LoadUIFormFromAllUIFormsCatch(uiType);

            if (baseUIForms == null)
            {
                return(null);
            }

            //是否需要清空【栈集合】,如果需要则清空。
            if (baseUIForms.CurrentUIType.NeedClearingStack)
            {
                ClearingStack();
            }
            //初始化UI窗体
            baseUIForms.Awake();
            //根据UI窗体的显示模式,做不同的处理
            switch (baseUIForms.CurrentUIType.UIForms_ShowMode)
            {
            case UIFormsShowMode.Normal:                    //默认显示
                LoadFormsToCurrentShowCache(uiType);
                break;

            case UIFormsShowMode.ReverseChange:             //反向切换
                PushUiFormsToStack(uiType);
                break;

            case UIFormsShowMode.HideOther:                 //隐藏其他
                EnterUIFormsAndHideOther(uiType);
                break;
            }

            return(baseUIForms);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 打开UI
        ///
        /// 加载指定名称的UI窗体预设到内存中,对不同显示类型的窗体做不同处理
        /// </summary>
        /// <param name="uiType">ui窗体的类型</param>
        /// <returns></returns>
        public BaseUIForms ShowUIForms(Type uiType)
        {
            //根据UI窗体名称,将预设加载到“所有窗体”的缓存集合中
            Debug.Log("HotFix******************************************");
            //初始化UI窗体

            BaseUIForms baseUIForms = this.LoadUIFormFromAllUIFormsCatch(uiType);

            if (baseUIForms == null)
            {
                return(null);
            }

            //是否需要清空【栈集合】,如果需要则清空。
            if (baseUIForms.CurrentUIType.NeedClearingStack)
            {
                ClearingStack();
            }
            if (!baseUIForms.GObj)
            {
                baseUIForms.Awake(baseUIForms);
            }

            //根据UI窗体的显示模式,做不同的处理
            switch (baseUIForms.CurrentUIType.UIForms_ShowMode)
            {
            case UIFormsShowMode.Normal:                    //默认显示
                LoadFormsToCurrentShowCache(uiType);
                break;

            case UIFormsShowMode.ReverseChange:             //反向切换
                PushUiFormsToStack(uiType);
                break;

            case UIFormsShowMode.HideOther:                 //隐藏其他
                EnterUIFormsAndHideOther(uiType);
                break;
            }
            //根据弹窗类型,放在对应的父对象下边
            switch (baseUIForms.CurrentUIType.UIForms_Type)
            {
            case UIFormsType.Normal:
                baseUIForms.GObj.transform.SetParent(_CanTransformNormal, false);
                break;

            case UIFormsType.PopUp:
                baseUIForms.GObj.transform.SetParent(_CanTransformPopUp, false);
                break;

            default:
                break;
            }
            return(baseUIForms);
        }