コード例 #1
0
        /// <summary>
        /// 游戏中所有场景均不与其他资源打包在同一个 AssetBundle,可以多个场景打同一个 AssetBundle 包,清理时直接根据引用计数清理即可
        /// </summary>
        /// <param name="group">Group.</param>
        public void ClearGroup(string group)
        {
            Dictionary <string, int> dict = mCount.GetSubDict(group);

            foreach (var item in dict)
            {
                ResManager.Instance.UnloadAssetBundle(item.Key, false, item.Value);
            }
            mCount.ClearSubDict(group);
        }
コード例 #2
0
        public void ClearGroup(string group)
        {
            Dictionary <string, int> counts = mGroupsCounter.GetSubDict(group);

            if (null != counts)
            {
                foreach (var item in counts)
                {
                    mResMgr.UnloadAssetBundle(item.Key, false, item.Value);
                }
                mGroupsCounter.ClearSubDict(group);

                Dictionary <string, HashSet <string> > dict;
                if (mGroupObjs.TryGetValue(group, out dict))
                {
                    foreach (var item in dict)
                    {
                        mDict.ClearObjs(item.Key, new List <string>(item.Value).ToArray());
                    }
                    //Dictionary<string, T> objs = mDict.GetSubDict(group);
                    mGroupObjs.Remove(group);
                }
            }
        }