public static void DestroyUI(UIWindowBase l_UI) { if (GetIsExitsHide(l_UI)) { RemoveHideUI(l_UI); } else if (GetIsExits(l_UI)) { RemoveUI(l_UI); } UISystemEvent.Dispatch(l_UI, UIEvent.OnDestroy); //派发OnDestroy事件 try { l_UI.DestroyUI(); } catch (Exception e) { Debug.LogError("OnDestroy :" + e.ToString()); } Destroy(l_UI.gameObject); }