Contains() public static method

是否下载过资源
public static Contains ( int keyhash ) : bool
keyhash int
return bool
Ejemplo n.º 1
0
 /// <summary>
 /// 判断加载
 /// </summary>
 /// <param name="req"></param>
 /// <returns></returns>
 static protected bool CheckLoadedAssetBundle(CRequest req)
 {
     if (CacheManager.Contains(req.keyHashCode))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 加载依赖项目
        /// </summary>
        /// <param name="req"></param>
        static protected int[] LoadDependencies(CRequest req)
        {
            string[] deps = assetBundleManifest.GetAllDependencies(req.assetBundleName);

            if (deps.Length == 0)
            {
                return(null);
            }
            string   dep_url;
            string   depAbName = "";
            CRequest item;

            int[] hashs = new int[deps.Length];
            int   keyhash;

            for (int i = 0; i < deps.Length; i++)
            {
                depAbName = deps [i];
                dep_url   = RemapVariantName(depAbName);
                keyhash   = LuaHelper.StringToHash(dep_url);
                hashs[i]  = keyhash;
                if (CacheManager.Contains(keyhash))
                {
                    CountMananger.Add(keyhash);                      //引用数量加1
                }
                else
                {
                    item             = LRequestPool.Get();         //new CRequest(dep_url);
                    item.relativeUrl = dep_url;
                    item.isShared    = true;
                    item.async       = false;
                    //依赖项目
                    string[] depds = assetBundleManifest.GetAllDependencies(item.assetBundleName);
                    if (depds.Length > 0)
                    {
                        int[] hash1s = new int[depds.Length];
                        for (int i1 = 0; i1 < depds.Length; i1++)
                        {
                            depAbName  = depds [i1];
                            dep_url    = RemapVariantName(depAbName);
                            keyhash    = LuaHelper.StringToHash(dep_url);
                            hash1s[i1] = keyhash;
                        }
                        item.allDependencies = hash1s;
                    }
                                        #if HUGULA_LOADER_DEBUG
                    Debug.LogFormat("<color=yellow> Req(assetname={0}) /r/n Begin LoadDependencies Req(assetname={1},url={2}) frameCount{3}</color>", req.assetBundleName, item.assetName, item.url, Time.frameCount);
                                        #endif
                    item.isNormal = req.isNormal;
                    item.uris     = req.uris;
                    AddReqToQueue(item);
                }
            }

            return(hashs);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 判断加载
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        static protected bool CheckLoadAssetBundle(CRequest req)
        {
            if (CacheManager.Contains(req.keyHashCode))
            {
                return(true);
            }

            if (downloadings.ContainsKey(req.udKey))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// check load from cache
        /// </summary>
        /// <param name="req"></param>
        static bool CheckLoadAssetAsync(CRequest req)
        {
#if UNITY_EDITOR
            if (SimulateAssetBundleInEditor && CacheManager.SetRequestDataFromPrefab(req))
            {
                loadingAssetQueue.Add(req);
                return(true);
            }
#endif

            ABDelayUnloadManager.CheckRemove(req.keyHashCode);
            if (CacheManager.Contains(req.keyHashCode))
            {
                AddReqToAssetCallBackList(req);
                return(true);
            }
            return(false);
        }