/// <summary> /// 组件销毁执行的析构函数 /// </summary> public override void Dispose() { if (this.IsDisposed) { return; } //清空层级管理容器 foreach (List <FairyGUIBaseUI> uIList in _LayerDictionary.Values) { if (uIList == null || uIList.Count <= 0) { continue; } for (int i = uIList.Count - 1; i >= 0; i--) { FairyGUIBaseUI uiListItem = uIList[i]; if (uiListItem != null && !uiListItem.IsDisposed) { uiListItem.Dispose(); } } uIList.Clear(); } _LayerDictionary.Clear(); //清空baseUIContainer baseUIContainer.Dispose(); base.Dispose(); }
/// <summary> /// 关闭同层ui. /// </summary> /// <param name="ui"></param> public void DestoryLayer(FairyGUIBaseUI ui) { List <FairyGUIBaseUI> uIList = _LayerDictionary[ui.UIType]; if (uIList == null || uIList.Count <= 0) { return; } for (int i = uIList.Count - 1; i >= 0; i--) { FairyGUIBaseUI uiListItem = uIList[i]; if (uiListItem != null && !uiListItem.IsDisposed) { uiListItem.Close(); } } uIList.Clear(); }
/// <summary> /// 清除所有UI /// </summary> public void DestoryAll() { foreach (List <FairyGUIBaseUI> uIList in _LayerDictionary.Values) { if (uIList == null || uIList.Count <= 0) { continue; } for (int i = uIList.Count - 1; i >= 0; i--) { FairyGUIBaseUI uiListItem = uIList[i]; if (uiListItem != null && !uiListItem.IsDisposed) { uiListItem.Dispose(); } } uIList.Clear(); } baseUIContainer.Dispose(); }
/// <summary> /// 销毁UI Mono使用 /// </summary> public void Destory(FairyGUIBaseUI ui) { //从层中移除 _LayerDictionary[ui.UIType].Remove(ui); baseUIContainer.RemoveComponent(ui.GetType()); }