private void ShowUI(ref UIOpenInfo _info) { if (UIMap.ContainsKey(_info.UIName)) { isHide = false; UIViewBase ui = UIMap[_info.UIName]; if (_info.UIObj == null) { _info.UIObj = ui.gameObject; } // 加入显示列表 if (!UIShowMap.ContainsKey(_info.UIName)) { UIShowMap.Add(_info.UIName, _info); UICtrl.Instance.C2CUIOpenCreatSucc(_info); } //清除隐藏列表 if (UIHideDic.ContainsKey(_info.UIName)) { UIHideDic.Remove(_info.UIName); ui.gameObject.SetActive(true); isHide = true; } try { //如果是隐藏界面显示 就不调用初始化了 if (isHide) { return; } ui.OnPushData(_info.ParamsVar); ui.Init(); ui.OnShow(); } catch (Exception e) { Debug.LogError("UI显示错误::" + e.ToString()); } } }
/// <summary> /// 隐藏UI /// </summary> /// <param name="uiName"></param> public void HideUI(UIOpenInfo _info) { if (!UIMap.ContainsKey(_info.UIName)) { return; } UIShowMap.Remove(_info.UIName); UIViewBase ui = UIMap[_info.UIName]; ui.OnHide(); ui.gameObject.SetActive(false); if (UIHideDic.ContainsKey(_info.UIName)) { UIHideDic.Remove(_info.UIName); } UIHideDic.Add(_info.UIName, _info); }