Exemplo n.º 1
0
        void Update()
        {
            // Collect all the finished WWWs.
            var remoteList = new List <string>();
            var keys       = cache.WwwCache.Keys;

            foreach (var key in keys)
            {
                WWW download = cache.WwwCache[key];
                // 下载失败
                if (download.error != null)
                {
                    com.QH.QPGame.GameUtils.Logger.Res.LogError(key + " load failed!!!! Error:" + download.error + " URI:" + download.url);

                    cache.ErrorCache.Add(key, download.error);
                    remoteList.Add(key);
                }
                // 下载成功
                else if (download.isDone)
                {
                    com.QH.QPGame.GameUtils.Logger.Res.Log(key + " loaded:" + download.assetBundle.name + " URI:" + download.url);

                    LOAssetBundle ab = new LOAssetBundle(download.assetBundle, key);
                    cache.SetBundleCache(key, ab);
                    //download.assetBundle.Unload(false);
                    remoteList.Add(key);
                }
            }

            foreach (var ab in remoteList)
            {
                cache.WwwCache[ab].Dispose();
                cache.WwwCache.Remove(ab);
            }
        }