private bool DestroyUIInternal(string p_name) { try { if (!m_UIItemMap.ContainsKey(p_name)) { throw new KeyNotFoundException(string.Format("Cannot destroy UI: {0} cause key not found in UIItemMap", p_name)); } var item = m_UIItemMap[p_name]; Object.Destroy(item.RootObject); if (item.Mediator != null) { MediatorManager.GetInstance().Remove(item.Mediator.GetType()); } GameAssets.SubBundleRef(m_UIItemMap[p_name].BundlePath); m_UICategoryMap[item.CategoryName].RemoveItem(item); m_UIItemMap.Remove(p_name); return(true); } catch (Exception e) { LogModule.ErrorLog("Exception in destroy UI, {0}\n{1}", e.Message, e.StackTrace); return(false); } }
public void OnDestroy() { if (View != null && View.gameObject != null) { Object.Destroy(View.gameObject); } GameAssets.SubBundleRef(BattleUIView.BundleName); }