private void UnloadAssetBundleInternal(string variantsName, bool v)
        {
            AssetBundleRef abr = this.GetAssetBundleRef(variantsName);

            if (abr == null)
            {
                return;
            }

            abr.m_ReferencedCount--;
            if (abr.m_ReferencedCount == 0)
            {
                abr.assetBundle.Unload(v);
                abr.assetBundle = null;
                dictAssetBundleRefs.Remove(variantsName);

                Debug.Log(variantsName + " has been unloaded successfully");
            }
        }
        /// <summary>
        /// 开始真正加载
        /// </summary>
        /// <returns><c>true</c>, if asset bundle internal was loaded, <c>false</c> otherwise.</returns>
        /// <param name="assetBundleName">Asset bundle name.</param>
        private bool LoadAssetBundleInternal(string assetBundleName, string variants)
        {
            // Already loaded.
            AssetBundleRef bundle       = null;
            string         variantsName = this.GetVariants(assetBundleName, variants);

            // 已经下载
            dictAssetBundleRefs.TryGetValue(variantsName, out bundle);
            if (bundle != null)
            {
                bundle.m_ReferencedCount++;
                return(true);
            }

            // 正在加载
            if (dicLoadings.ContainsKey(variantsName))
            {
                if (this.abRefCntLoadingDic.ContainsKey(variantsName))
                {
                    this.abRefCntLoadingDic[variantsName]++;
                }
                else
                {
                    this.abRefCntLoadingDic[variantsName] = 2;
                }

                return(true);
            }

            // 加载的时候带着variants,但是保存的时候使用assetBundleName
            string path = this.FindPath(variantsName);
            AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(path, 0);

            dicLoadings.Add(variantsName, request);

            return(false);
        }
        void Update()
        {
            #if UNITY_EDITOR
            if (SimulateAssetBundleInEditor)
            {
                return;
            }
            #endif

            if (dicLoadings == null || dicLoadings.Count == 0)
            {
                return;
            }
            // Collect all the finished WWWs.
            List <string> keysToRemove = new List <string>();
            foreach (var keyValue in this.dicLoadings)
            {
                AssetBundleCreateRequest request = keyValue.Value;

                // isDone也有可能在系统错误的时候返回
                if (request.isDone)
                {
                    AssetBundle bundle = request.assetBundle;
                    if (bundle == null)
                    {
                        Debug.LogError(string.Format("Failed load bundle {0} : bundle is null", keyValue.Key));
                        keysToRemove.Add(keyValue.Key);

                        if (this.abRefCntLoadingDic.ContainsKey(keyValue.Key))
                        {
                            this.abRefCntLoadingDic[keyValue.Key]--;
                            if (this.abRefCntLoadingDic[keyValue.Key] == 0)
                            {
                                this.abRefCntLoadingDic.Remove(keyValue.Key);
                            }
                        }

                        continue;
                    }

                    int rCount = 1;
                    if (this.abRefCntLoadingDic.ContainsKey(keyValue.Key))
                    {
                        rCount = this.abRefCntLoadingDic[keyValue.Key];
                        this.abRefCntLoadingDic.Remove(keyValue.Key);
                    }

                    AssetBundleRef abr = new AssetBundleRef(keyValue.Key, bundle);
                    abr.m_ReferencedCount = rCount;
                    dictAssetBundleRefs.Add(keyValue.Key, abr);
                    keysToRemove.Add(keyValue.Key);
                }
            }

            // Remove the finished WWWs.
            foreach (var key in keysToRemove)
            {
                AssetBundleCreateRequest request = this.dicLoadings[key];
                this.dicLoadings.Remove(key);
                request = null;
            }

            // Update all in progress operations
            for (int i = 0; i < inProgressOperations.Count;)
            {
                AssetBundleOperation operation = inProgressOperations[i];
                if (!operation.Update())
                {
                    inProgressOperations.RemoveAt(i);
                }
                else
                {
                    i++;
                }
            }

            // 可以继续加载
            while (this.downList.Count > 0 && (this.dicLoadings.Count <= this._maxSize))
            {
                LoadTask task = this.downList[0];
                this.LoadAssetAsync(task.scope, task.name, task.variants, task.callBack, task.baseCallBack);

                this.downList.RemoveAt(0);
            }
        }