Пример #1
0
        public static bool CheckPersistentCrc(ABInfo abInfo)
        {
#if UNITY_EDITOR
            if (SimulateAssetBundleInEditor)
            {
                return(true);
            }
#endif
            uint crc = 0;
            if (abInfo.state == ABInfoState.None)
            {
                uint len = 0;
                var  url = CUtils.PathCombine(CUtils.GetRealPersistentDataPath(), abInfo.abName);
                crc = CrcCheck.GetLocalFileCrc(url, out len);
                if (crc == abInfo.crc32)
                {
                    abInfo.state = ABInfoState.Success;
                }
                else
                {
                    abInfo.state = ABInfoState.Fail;
                }
            }
            return(abInfo.state == ABInfoState.Success);
        }
Пример #2
0
        protected static bool AddReqToQueue(CRequest req, GroupRequestRecord group = null)
        {
            if (req == null)
            {
                return(false);
            }

            if (!CrcCheck.CheckUriCrc(req)) //如果校验失败
            {
#if HUGULA_LOADER_DEBUG
                Debug.LogFormat(" 0. <color=yellow>CheckCrcUri0Exists==false Req(assetname={0},url={1})  </color>", req.assetName, req.url);
#endif
                CallbackError(req);
                return(false);
            }

            string key = req.udKey;       //need re
            if (CheckLoadAssetAsync(req)) //已经下载
            {
                return(false);
            }
            else if (requestCallBackList.ContainsKey(key)) //回调列表
            {
                requestCallBackList[key].Add(req);
                if (!req.isShared)
                {
                    if (group != null)
                    {
                        PushGroup(req, group);
                    }
                }
                return(true);
            }
            else
            {
                var listreqs = ListPool <CRequest> .Get(); //new List<CRequest>();

                requestCallBackList.Add(key, listreqs);
                listreqs.Add(req);

                if (queue.Count == 0 && currentLoading == 0 && loadingAssetBundleQueue.Count == 0)
                {
                    totalLoading  = 0;
                    currentLoaded = 0;
                }

                if (req.isShared)
                {
                    QueueOrLoad(req);                     //realyLoadingQueue.Enqueue (req);
                }
                else if (!req.isNormal)
                {
                    QueueOrLoad(req);
                    if (group != null)
                    {
                        PushGroup(req, group);
                    }
                }
                else
                {
                    queue.Push(req);
                    totalLoading++;
                    if (group != null)
                    {
                        PushGroup(req, group);
                    }
                }
                return(true);
            }
        }