public UIWindowBase OpenUIWindow <T>(string UIName, UIType uitype = UIType.Normal, GameFrameworkAction <UIWindowBase> callback = null) { if (EUIManagerState != EUIManagerState.e_Idle) { return(null); } UIWindowBase UIbase = GetUI(UIName, false); if (UIbase == null) { UIbase = CreateUIWindow <T>(UIName); } UIbase.m_UIType = uitype; try { UIbase.SetActive(true); UIbase.OnOpenUI(); } catch (Exception e) { DebugHandler.LogError(UIName + " OnOpen Exception: " + e.ToString()); } m_UILayerManagerCom.SetLayer(UIbase); return(UIbase); }
/// <summary> /// 关闭UI /// </summary> /// <param name="UI">目标UI</param> public void CloseUIWindow(UIWindowBase UI, GameFrameworkAction <UIWindowBase> callback = null) { if (!UI.GetActive())//如果关闭 { return; } m_UILayerManagerCom.RemoveUI(UI); callback.InvokeGracefully <UIWindowBase>(UI); UI.OnCloseUI(); UI.SetActive(false); }
public T OpenInstanceUIWindow <T>() where T : UIWindowBase { if (EUIManagerState != EUIManagerState.e_Idle) { return(null); } string UIName = typeof(T).Name; UIWindowBase UIbase = GetUI(UIName); if (UIbase == null) { UIbase = OpenUIWindow <T>(); } else { UIbase.SetActive(true); UIbase.OnOpenUI(); } return(UIbase as T); }