예제 #1
0
        /// <summary>
        /// 退出当前显示的【普通窗体】
        /// </summary>
        /// <param name="uiType">UI窗体名称</param>
        private void ExitNormalForms(Type uiType)
        {
            BaseUIForms baseUIForms = null;                 //UI窗体基类

            //参数校验【当前显示集合】中没有直接返回
            _DicCurrentShowUIForms.TryGetValue(uiType, out baseUIForms);
            if (baseUIForms == null)
            {
                return;
            }
            //隐藏窗体
            baseUIForms.Hiding();
            //从【当前显示集合】中移除
            _DicCurrentShowUIForms.Remove(uiType);
        }
예제 #2
0
        /// <summary>
        /// 根据指定名称创建UI实体 将实体加载到“所有窗体”的集合中
        /// 1.根据uiType创建BaseUIforms实例
        /// 2.把UI克隆体加载到“所有UI窗体集合”
        /// 3.初始化UI窗体。
        /// </summary>
        /// <param name="uiType"></param>
        /// <returns></returns>
        private BaseUIForms CreateUiForms(Type uiType)
        {
            //根据类型创建
            BaseUIForms baseUIForms = Activator.CreateInstance(uiType) as BaseUIForms;

            if (baseUIForms == null)
            {
                Log.Error("Error!BaseUIForms is null,please check the UIForm:" + uiType.Name);
                return(null);
            }
            //加载到“所有UI窗体集合”
            this._DicAllUIForms.Add(uiType, baseUIForms);

            return(baseUIForms);
        }
예제 #3
0
        /// <summary>
        /// 清空栈集合。
        /// </summary>
        private void ClearingStack()
        {
            Log.Debug("------------------------开始清理栈结构");
            if (_StaCurrentUIForms != null && _StaCurrentUIForms.Count > 0)
            {
                while (this._StaCurrentUIForms.Count > 0)
                {
                    BaseUIForms ui = this._StaCurrentUIForms.Pop();

                    ui.Hiding();
                }
                _StaCurrentUIForms.Clear();
            }
            Log.Debug("-----------------------栈结构清理结束");
        }
예제 #4
0
        /// <summary>
        /// 根据UI窗体名称,将预设加载到“所有窗体”的集合中
        ///     检查指定类型的ui是否已经加载到集合缓存中,如果缓存中没有才进行创建。
        /// </summary>
        /// <param name="uiType"></param>
        /// <returns></returns>
        private BaseUIForms LoadUIFormFromAllUIFormsCatch(Type uiType)
        {
            //定义返回结果引用变量。
            BaseUIForms baseUIFormsResult = null;

            //检查_DicAllUIForms缓存中是否存在
            _DicAllUIForms.TryGetValue(uiType, out baseUIFormsResult);

            if (baseUIFormsResult == null)
            {
                //根据指定名称加载UI窗体预设  将预设加载到“所有窗体”的集合中
                baseUIFormsResult = this.CreateUiForms(uiType);
            }

            return(baseUIFormsResult);
        }
예제 #5
0
 /// <summary>
 /// 退出【反向切换】的窗体。从栈顶弹出隐藏,之后重新显示栈顶的窗体
 /// </summary>
 private void ExitReverseChangeForms()
 {
     if (_StaCurrentUIForms.Count >= 2)
     {
         BaseUIForms topUIForm = _StaCurrentUIForms.Pop();
         topUIForm.Hiding();
         //因为Hiding的原因,会导致栈离的count提前减去。在这里判断一下防止emptyStack异常,以后有好的注意再优化!!!!!!!!!
         if (this._StaCurrentUIForms.Count > 0)
         {
             BaseUIForms nextUIForm = _StaCurrentUIForms.Peek();
             nextUIForm.ReDisplay();
         }
     }
     else if (_StaCurrentUIForms.Count == 1)
     {
         BaseUIForms topUIForm = _StaCurrentUIForms.Pop();
         topUIForm.Hiding();
     }
 }
예제 #6
0
        public void Awake(BaseUIForms forms)
        {
            if (string.IsNullOrEmpty(abName))
            {
                Log.Error(this.GetType() + "/Awake() 初始化Ui界面失败,Gobj为空!");
                return;
            }
            this.thisForms = forms;
            //string bundleName = this.abName.ToLower();
            string             bundleName         = abName;
            ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>();

            resourcesComponent.LoadBundle($"{bundleName }.unity3d");
            GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset($"{bundleName}.unity3d", $"{bundleName}");

            GObj = UnityEngine.Object.Instantiate(bundleGameObject);
            // forms.gameObject = GObj;
            InitUI();
        }