public void DestroyUI(CUIWindowBase UI) { Debug.Log("UIManager DestroyUI " + UI.name); CUIManagerHelper.RemoveUIFromCache(UI, HiddenDict); CUIManagerHelper.RemoveUIFromCache(UI, ActiveDict); Destroy(UI.gameObject); }
private void InternalCloseUI(CUIWindowBase window, params object[] objs) { try { window.OnClose(); } catch (Exception e) { Debug.LogError(window.UIName + " OnClose Exception: " + e.ToString()); } StackManager.OnUIClose(window); CUIManagerHelper.AddUIToCache(window, HiddenDict); }
/// <summary> /// 根据类型关闭一个ui /// </summary> public void CloseUI <T>(bool isPlayAnim = true, UICallBack callback = null, params object[] objs) where T : CUIWindowBase { string winName = typeof(T).Name; CUIWindowBase window = CUIManagerHelper.GetUIFromCache(winName, ActiveDict); if (window == null) { Debug.LogError("CloseUIWindow Error UI ->" + winName + "<- not Exist!"); return; } CloseUI(window, isPlayAnim, callback, objs); }
public void OpenUI <T>(UICallBack callback = null, params object[] objs) where T : CUIWindowBase { string winName = typeof(T).Name; CUIWindowBase window = CUIManagerHelper.GetUIFromCache(winName, HiddenDict); if (window == null) { CreateUI <T>(go => { window = go.GetComponent <T>(); InternalOpenUI(window, callback, objs); }); return; } InternalOpenUI(window, callback, objs); }
private void InternalCreateUI <T>(GameObject go) where T : CUIWindowBase { string winName = typeof(T).Name; CUIWindowBase window = go.GetComponent <CUIWindowBase>(); try { int id = CUIManagerHelper.GetUIIDFromCache(winName, ActiveDict); window.Init(id); window.OnCreated(); } catch (Exception e) { Debug.LogError("OnInit Exception: " + e.ToString()); } window.OnHide(); CUIManagerHelper.AddUIToCache(window, HiddenDict); LayerManager.SetLayer(window); //设置层级 }
private void InternalOpenUI(CUIWindowBase window, UICallBack callback, params object[] objs) { if (window == null) { throw new Exception("UIManager: InternalOpenUI window is null"); } CUIManagerHelper.RemoveUIFromCache(window, HiddenDict); CUIManagerHelper.AddUIToCache(window, ActiveDict); StackManager.OnUIOpen(window); try { window.OnOpen(objs); } catch (Exception e) { Debug.LogError(window.UIName + " OnOpen Exception: " + e); } AnimManager.StartEnterAnim(window, callback); //播放动画 }
/// <summary> /// 关闭传入的ui实例 /// </summary> public void CloseUI(CUIWindowBase window, bool isPlayAnim = true, UICallBack callback = null, params object[] objs) { CUIManagerHelper.RemoveUIFromCache(window, ActiveDict); if (callback != null) { callback += InternalCloseUI; } else { callback = InternalCloseUI; } //不播放动画直接调用回调 if (!isPlayAnim) { callback(window, objs); return; } AnimManager.StartExitAnim(window, callback); }
public void DestroyAllUI() { CUIManagerHelper.DestroyUIInCache(ActiveDict); CUIManagerHelper.DestroyUIInCache(HiddenDict); }
public CUIWindowBase HideUI(string winName) { CUIWindowBase ui = CUIManagerHelper.GetUIFromCache(winName, ActiveDict); return(HideUI(ui)); }
public CUIWindowBase ShowUI(string viewName) { CUIWindowBase ui = CUIManagerHelper.GetUIFromCache(viewName, ActiveDict); return(RevealUI(ui)); }