예제 #1
0
        /// <summary>
        /// 释放无引用的资源
        /// </summary>
        public void ReleaseUnused()
        {
            if (m_url2goList.Count == 0)
            {
                return;
            }

            List <string>     delList = null;
            List <GameObject> goList;

            foreach (var kvp in m_url2goList)
            {
                goList = kvp.Value;

                for (int i = goList.Count - 1; i >= 0; --i)
                {
                    if (goList[i])
                    {
                    }
                    else
                    {
                        //已被destroy
                        goList.RemoveAt(i);
                    }
                }

                if (goList.Count == 0)
                {
                    //全部销毁了, 释放引用
                    if (delList == null)
                    {
                        delList = new List <string>();
                    }
                    delList.Add(kvp.Key);

                    AssetCache.me.ReleaseByUrl(this, kvp.Key);
                }
            }

            //字典删除方案
            if (delList != null)
            {
                DicUtil.RemoveByKeys <string, List <GameObject> >(m_url2goList, delList);
            }
        }
예제 #2
0
        //移除所有窗口
        protected void DelAllPops()
        {
            if (m_id2pop.Count == 0)
            {
                return;
            }

            ClearStack();   //清空堆栈

            IPop[] pops = DicUtil.ToValues <string, IPop>(m_id2pop);
            m_id2pop.Clear();

            IPop pop;

            for (int i = 0; i < pops.Length; ++i)
            {
                pop = pops[i];
                pop.DestroyRemove();
                pop.Release(this);
                //GameObjUtil.Delete( pop );
            }
        }