예제 #1
0
        /// <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();
        }
예제 #2
0
        /// <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();
        }
예제 #3
0
        /// <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();
        }
예제 #4
0
 /// <summary>
 /// 销毁UI Mono使用
 /// </summary>
 public void Destory(FairyGUIBaseUI ui)
 {
     //从层中移除
     _LayerDictionary[ui.UIType].Remove(ui);
     baseUIContainer.RemoveComponent(ui.GetType());
 }