Get() public static method

public static Get ( ) : LRequest
return LRequest
Exemplo n.º 1
0
        /// <summary>
        /// stop the url.
        /// </summary>
        /// <param name="req">Req.</param>
        /// <param name="group">Group.</param>
        public void StopURL(string url)
        {
            LRequest reqUrl = LRequestPool.Get();

            reqUrl.relativeUrl = url;
            StopReq(reqUrl);
            LRequestPool.Release(reqUrl);
        }
Exemplo 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);
        }
Exemplo n.º 3
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];
                if (string.IsNullOrEmpty(depAbName)) // Dependency assetbundle name is empty  unity bug?
                {
                    #if UNITY_EDITOR
                    Debug.LogWarningFormat("the request({0},{1}) Dependencies {2} is empty ", req.assetName, req.url, i);
                    #endif
                    hashs[i] = 0;
                    continue;
                }
                dep_url  = RemapVariantName(depAbName);
                keyhash  = LuaHelper.StringToHash(dep_url);
                hashs[i] = keyhash;
                CacheData sharedCD = CacheManager.GetCache(keyhash);
                if (sharedCD != null)
                {
                    CountMananger.Add(keyhash);                      //引用数量加1
                    if (!sharedCD.isAssetLoaded)
                    {
                        item               = LRequestPool.Get(); //new CRequest(dep_url);
                        item.relativeUrl   = dep_url;
                        item.isShared      = true;
                        item.async         = false;
                        item.isAssetBundle = true;

                        CacheManager.SetRequestDataFromCache(req);
                        if (_instance && _instance.OnSharedComplete != null)
                        {
                            _instance.OnSharedComplete(item);
                        }

                        LRequestPool.Release(item);
                    }
            #if HUGULA_LOADER_DEBUG
                    Debug.LogFormat(" 0.3 <color=#153AC1>Request(assetName={0}, url={1},isShared={2}) Dependencies  CacheManager.Contains(url={3},sharedCD.isAssetLoaded={4}) </color>", req.assetName, req.url, req.isShared, dep_url, sharedCD.isAssetLoaded);
                        #endif
                }
                else
                {
                    item               = LRequestPool.Get();       //new CRequest(dep_url);
                    item.relativeUrl   = dep_url;
                    item.isShared      = true;
                    item.async         = false;
                    item.isAssetBundle = true;
                    //依赖项目
                    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=#153AC1>0.5  Request(assetname={0}) Begin Load Dependencies Req(assetname={1},url={2}) frameCount{3}</color>", req.assetName, item.assetName, item.url, Time.frameCount);
                                        #endif
                    item.isNormal = false;
                    item.priority = req.priority;
                    item.uris     = req.uris;
                    AddReqToQueue(item);
                }
            }

            return(hashs);
        }