示例#1
0
//--------------------------------------------------------------------------------------


        /// <summary>
        /// 出栈,清除栈顶的窗体
        /// </summary>
        private void PopUIForm()
        {
            //如果栈中存在2个以上窗体
            if (_UIFormsStack.Count >= 2)
            {
                //移除顶上窗体
                BaseUIForms topBaseUI = _UIFormsStack.Pop();
                topBaseUI.Hide();
                //返回当前顶层窗体
                BaseUIForms curBaseUI = _UIFormsStack.Peek();
                curBaseUI.RedisPlay();
            }

            else//只存在一个窗体,直接隐藏
            if (_UIFormsStack.Count == 1)
            {
                BaseUIForms baseUI = _UIFormsStack.Pop();
                baseUI.Hide();
            }
        }
示例#2
0
        public void ShowUIForm(string strUIFormName)
        {
            BaseUIForms baseUiForms = null;

            //空名称结束程序
            if (string.IsNullOrEmpty(strUIFormName))
            {
                return;
            }

            //获取到指定的窗体基础类
            baseUiForms = LoadUIFormFromAllForms(strUIFormName);
            if (baseUiForms == null)
            {
                return;
            }

            //此窗体的显示方式
            switch (baseUiForms.UiType.m_UIFormShowType)
            {
            //正常窗体
            case UIFormShowType.Normal:
                EnterUIForm(strUIFormName);
                break;

            //隐藏其他窗体
            case UIFormShowType.HideOther:
                EnterUIFormAndHideOther(strUIFormName);
                break;

            //模态窗体
            case UIFormShowType.ReverseChange:
                PushUIForm(strUIFormName);
                break;

            default:
                break;
            }
        }
示例#3
0
//--------------------------------------------------------------------------------------


        /// <summary>
        /// 显示方式为ReverseChange型窗体的显示操作
        /// 用栈结构来处理模态窗体的层级关系
        /// </summary>
        private void PushUIForm(string UIFormName)
        {
            BaseUIForms baseUiForms;

            //检查是否存在栈顶元素
            if (_UIFormsStack.Count > 0)
            {
                BaseUIForms baseUI = _UIFormsStack.Peek();
                baseUI.Free();
            }

            _dicAllUIForms.TryGetValue(UIFormName, out baseUiForms);

            if (baseUiForms != null)
            {
                //将窗体推入栈
                _UIFormsStack.Push(baseUiForms);
                baseUiForms.DisPlay();
            }
            else
            {
                Debug.Log("无法提取到窗体资源:" + UIFormName);
            }
        }