public void CloseUIView(BaseUIView closeUIView) { if (closeUIView == null) { return; } if (closeUIView.DeleteOnHide) { _allUIView.Remove(closeUIView.UIType); _backUIViewQueue.Remove(closeUIView); _openUIViewQueue.Remove(closeUIView); closeUIView.Hide(); closeUIView.Release(); GameObject.Destroy(closeUIView.gameObject); } else { ChangeUIViewParent(closeUIView, true); closeUIView.ChangeCameraRenderTexture(false); closeUIView.ChangeCanvasLayer(HideLayer); closeUIView.ChangeGraphicRaycasterState(false); _openUIViewQueue.Remove(closeUIView); closeUIView.Hide(); } }
public BaseUIView OpenUIView(UI_TYPE uiType, object param = null) { BaseUIView baseUIView = null; if (!_allUIView.TryGetValue(uiType, out baseUIView)) { string uiAssetPath = GetUIAssetPathByUIType(uiType); GameObject goUI = GameObject.Instantiate(Resources.Load <GameObject>(uiAssetPath)); baseUIView = goUI.GetComponent <BaseUIView>(); _allUIView.Add(uiType, baseUIView); } else { if (!baseUIView.IsClose()) { baseUIView.Hide(); } } if (baseUIView.IsNeedBack()) { for (int i = 0, len = _backUIViewQueue.Count; i < len; ++i) { BaseUIView tempUIView = _backUIViewQueue[i]; if (tempUIView.Equals(baseUIView)) { _backUIViewQueue.RemoveAt(i); break; } } _backUIViewQueue.Add(baseUIView); } if (_openUIViewQueue.Contains(baseUIView)) { _openUIViewQueue.Remove(baseUIView); } _openUIViewQueue.Add(baseUIView); ChangeUIViewParent(baseUIView); HideOldView(); baseUIView.UIType = uiType; if (baseUIView.IsShowAfterOpenEffect) { baseUIView.UIParam = param; baseUIView.ShowOpenEffect(); } else { baseUIView.Show(param); } baseUIView.ChangeCameraRenderTexture(true); baseUIView.ChangeCanvasLayer(UILayer); baseUIView.ChangeGraphicRaycasterState(true); RefreshUISortingOrder(); return(baseUIView); }
public void CloseUIView() { if (_backUIViewQueue == null || _backUIViewQueue.Count <= 0) { return; } int lastIndex = _backUIViewQueue.Count - 1; BaseUIView closeUIView = _backUIViewQueue[lastIndex]; UI_TYPE closeUIType = closeUIView.UIType; _backUIViewQueue.RemoveAt(lastIndex); CloseUIView(closeUIView); if (lastIndex > 0) { BaseUIView showUIView = _backUIViewQueue[lastIndex - 1]; ChangeUIViewParent(showUIView); showUIView.ChangeCameraRenderTexture(true); showUIView.ChangeCanvasLayer(UILayer); showUIView.ChangeGraphicRaycasterState(true); showUIView.Back(); } }