/// <summary> /// 进入当前窗体并加载到当前集合中 /// </summary> /// <param name="uiFormName"></param> void EnterUIToCurrentCache(string strUIName) { BaseUIForm baseUIForm = null; //如果"正在显示"的集合中,存在整个UI窗体,则直接返回 _DicCurrentShowUIForms.TryGetValue(strUIName, out baseUIForm); if (baseUIForm != null) { return; } //把当前窗体,加载到"正在显示"集合中 _DicALLUIForms.TryGetValue(strUIName, out baseUIForm); if (baseUIForm != null) { _DicCurrentShowUIForms.Add(strUIName, baseUIForm); baseUIForm.Display(); } }
/// <summary> /// 通过uiFormName读取UIForms,并确定显示模式 /// </summary> /// <param name="uiFormName"></param> public void ShowUIForms(string uiFormName) { BaseUIForm baseUIForms = null; if (string.IsNullOrEmpty(uiFormName)) { Debug.Log("uiFormName 不能为0"); return; } baseUIForms = LoadFormsToAllUIFormsCatch(uiFormName); if (baseUIForms == null) { return; } //是否清空"栈集合"中得数据 if (baseUIForms.CurrentUIType.IsClearStack) { ClearStackArray(); } //根据不同的UI窗体的显示模式,分别作不同的加载处理 switch (baseUIForms.CurrentUIType.UIForms_ShowMode) { case UIFormShowMode.Normal: EnterUIToCurrentCache(uiFormName); break; case UIFormShowMode.ReverseChange: PushUIFormToStack(uiFormName); break; case UIFormShowMode.HideOther: EnterUIFormsAndHideOther(uiFormName); break; default: break; } }
/// <summary> /// (反向切换类型窗体)窗体出栈逻辑 /// </summary> void PopUIFroms(string strUIName) { if (_StaCurrentUIForms.Count >= 2) { //出栈处理 BaseUIForm topUIForm = _StaCurrentUIForms.Pop(); //隐藏该出栈对象 topUIForm.Hiding(); //获取出栈后的栈顶对象 BaseUIForm nextUIForm = _StaCurrentUIForms.Peek(); //被覆盖的上一个窗体重新显示 nextUIForm.Redisplay(); } if (_StaCurrentUIForms.Count == 1) { //出栈处理 BaseUIForm topUIForms = _StaCurrentUIForms.Pop(); //做隐藏处理 topUIForms.Hiding(); } }
/// <summary> /// UI窗体入栈 /// </summary> /// <param name="uiFormName"></param> void PushUIFormToStack(string strUIName) { BaseUIForm baseUIForm = null; if (_StaCurrentUIForms.Count > 0) { BaseUIForm TopUIForm = _StaCurrentUIForms.Peek(); //冻结栈顶元素 TopUIForm.Freeze(); } //从缓存字典中获取该窗体 _DicALLUIForms.TryGetValue(strUIName, out baseUIForm); if (baseUIForm == null) { Debug.Log("未能获取到该baseUIForm,参数strUIName=" + strUIName); } else { //显示该窗体 baseUIForm.Display(); //该窗体入栈操作 _StaCurrentUIForms.Push(baseUIForm); } }