public UIBase OpenUI(string prefabName, Transform parent = null, bool hideTheVisible = false, UIType uitp = UIType.NonPush) { if (parent == null) { parent = UINodesManager.NormalUIRoot; } if (this.IsOpen(prefabName)) { UIBase uIIfExist = this.GetUIIfExist(prefabName); uIIfExist.get_transform().SetParent(parent); uIIfExist.get_transform().set_localPosition(Vector3.get_zero()); uIIfExist.get_transform().set_localRotation(Quaternion.get_identity()); uIIfExist.get_transform().set_localScale(Vector3.get_one()); this.RefreshlistOpenUI(uIIfExist, true); return(uIIfExist); } if (!UIManagerControl.IsSpecialUI(prefabName)) { UIStateSystem.LockOfWaitOpenUI(prefabName); } if (hideTheVisible || uitp == UIType.FullScreen) { this.HideAllInNormalUIRoot(prefabName); } UIBase uIBase = this.LoadUINow(prefabName, parent, uitp); if (uIBase == null) { if (!UIManagerControl.IsSpecialUI(prefabName)) { EventDispatcher.Broadcast <string>("UIManagerControl.UIOpenOfSuccess", prefabName); } Debug.LogError("加载失败 : " + prefabName); return(null); } if (!UIManagerControl.IsSpecialUI(prefabName)) { GuideManager.Instance.CheckQueue(false, false); } this.RefreshlistOpenUI(uIBase, true); uIBase.Show(true); if (!UIManagerControl.IsSpecialUI(prefabName)) { GuideManager.Instance.CheckQueue(true, false); EventDispatcher.Broadcast("GuideManager.LevelNow"); } return(uIBase); }
public void OpenUI_Async(string prefabName, Action <UIBase> finish_callback = null, Transform parent = null) { int iD = UIID.GetID(prefabName); if (iD <= 0) { Debug.LogError("ui id is illegal, prefab name = " + prefabName); return; } WaitUI.OpenUI(0u); UINameTable dataNT = DataReader <UINameTable> .Get(iD); if (parent == null) { parent = WidgetSystem.GetRoot(dataNT.parent); } bool flag = false; if (dataNT.hideTheVisible == 1) { flag = true; } UIType type = (UIType)dataNT.type; if (this.IsOpen(dataNT.name)) { UIBase uIIfExist = this.GetUIIfExist(dataNT.name); uIIfExist.get_transform().SetParent(parent); uIIfExist.get_transform().set_localPosition(Vector3.get_zero()); uIIfExist.get_transform().set_localRotation(Quaternion.get_identity()); uIIfExist.get_transform().set_localScale(Vector3.get_one()); this.RefreshlistOpenUI(uIIfExist, true); WaitUI.CloseUI(0u); if (finish_callback != null) { finish_callback.Invoke(uIIfExist); } return; } if (!UIManagerControl.IsSpecialUI(dataNT.name)) { UIStateSystem.LockOfWaitOpenUI(dataNT.name); } if (flag || type == UIType.FullScreen) { this.HideAllInNormalUIRoot(dataNT.name); } AssetManager.AssetOfTPManager.LoadAtlas(PreloadUIBaseSystem.GetPreloads(dataNT.name), delegate { this.LoadUI(dataNT.name, parent, type, delegate(UIBase ub) { if (ub == null) { if (!UIManagerControl.IsSpecialUI(dataNT.name)) { EventDispatcher.Broadcast <string>("UIManagerControl.UIOpenOfSuccess", dataNT.name); } Debug.LogError("加载失败 : " + dataNT.name); WaitUI.CloseUI(0u); if (finish_callback != null) { finish_callback.Invoke(null); } return; } if (!UIManagerControl.IsSpecialUI(dataNT.name)) { GuideManager.Instance.CheckQueue(false, false); } this.RefreshlistOpenUI(ub, true); ub.Show(true); if (!UIManagerControl.IsSpecialUI(dataNT.name)) { GuideManager.Instance.CheckQueue(true, false); EventDispatcher.Broadcast("GuideManager.LevelNow"); } WaitUI.CloseUI(0u); if (finish_callback != null) { finish_callback.Invoke(ub); } }); }, 0); }