/// <summary> /// 打来"隐藏其他属性"的窗体,且隐藏其他所有窗体 /// </summary> /// <param name="uiFormName">需要打开的窗体名称</param> private void EnterUIFormsAndHideOther(string uiFormName) { BaseUIForm baseUiForm = null; BaseUIForm baeUiFormFromALL = null; // 参数检查 if (string.IsNullOrEmpty(uiFormName)) { return; } _dicCurrentShowUiForms.TryGetValue(uiFormName, out baseUiForm); if (baseUiForm != null) { return; // 已经显示,返回 } _dicAllUiForms.TryGetValue(uiFormName, out baeUiFormFromALL); if (baeUiFormFromALL == null) { return; } // 把 _dicCurrentShowUiForms 和 _staCurrentUiForms 中所有的窗体都隐藏 foreach (var item in _dicCurrentShowUiForms) { item.Value.Hiding(); } foreach (BaseUIForm uiForm in _staCurrentUiForms) { uiForm.Hiding(); } // 显示当前窗体,并且加入到 _dicCurrentShowUiForms baeUiFormFromALL.Display(); _dicCurrentShowUiForms.Add(uiFormName, baeUiFormFromALL); }
/// <summary> /// UI窗体入栈 /// </summary> /// <param name="uiFormName">窗体的名称</param> private void PushUIFormToStack(string uiFormName) { BaseUIForm baseUiForm = null; // 判断栈集合中,是否已有窗体,有则“冻结”处理 if (_staCurrentUiForms.Count > 0) { BaseUIForm topUIForm = _staCurrentUiForms.Peek(); topUIForm.Freeze(); } // 判断 _dicAllUiForms 中是否有指定的UI窗体 _dicAllUiForms.TryGetValue(uiFormName, out baseUiForm); if (baseUiForm != null) { baseUiForm.Display(); // 把指定的UI窗体,入栈操作 _staCurrentUiForms.Push(baseUiForm); } else { Debug.Log("BaseUIForm =NULL , uiFormName = " + uiFormName); } }