Esempio n. 1
0
        /// <summary>
        /// finish asset or http request
        /// </summary>
        /// <param name="operation"></param>
        internal static void ProcessFinishedOperation(ResourcesLoadOperation operation)
        {
            var  req     = operation.cRequest;
            bool isError = false;
            AssetBundleLoadAssetOperation assetLoad = operation as AssetBundleLoadAssetOperation;
            HttpLoadOperation             httpLoad;

            if (assetLoad != null)
            {
                loadingTasks.Remove(req);
                isError = assetLoad.error != null;
                SetCacheAsset(req);        // set asset cache
                DispatchAssetBundleLoadAssetOperation(req, isError);
                assetLoad.ReleaseToPool(); //relase AssetBundleLoadAssetOperation

                CheckAllComplete();        //check all complete
            }
            else if ((httpLoad = operation as HttpLoadOperation) != null)
            {
                isError = !string.IsNullOrEmpty(httpLoad.error);

                if (isError && CUtils.IsResolveHostError(httpLoad.error) && !CUtils.IsHttps(req.url))// http dns
                {
                    httpLoad.error = string.Format("dns resolve error url={0} ", req.url);
                    var httpDnsOp = HttpDnsResolve.Get();
                    httpDnsOp.SetRequest(req);
                    httpDnsOp.SetOriginalOperation(httpLoad);
                    inProgressOperations.Add(httpDnsOp);
                }
                else
                {
                    httpLoad.ReleaseToPool();

                    if (isError)
                    {
                        req.DispatchEnd();
                    }
                    else
                    {
                        req.DispatchComplete();
                    }

                    if (req.group != null)
                    {
                        req.group.Complete(req, isError);
                    }

                    req.ReleaseToPool();
                }
            }
            else
            {
                operation.ReleaseToPool();
            }
        }
Esempio n. 2
0
 public static void Release(HttpDnsResolve toRelease)
 {
     httpDnsOperationPool.Release(toRelease);
 }
Esempio n. 3
0
 private static void m_ActionOnRelease(HttpDnsResolve op)
 {
     op.Reset();
 }
Esempio n. 4
0
 private static void m_ActionOnGet(HttpDnsResolve op)
 {
     op.pool = true;
 }
Esempio n. 5
0
        /// <summary>
        /// finish asset or http request
        /// </summary>
        /// <param name="operation"></param>
        internal static void ProcessFinishedOperation(ResourcesLoadOperation operation)
        {
            var  req     = operation.cRequest;
            bool isError = false;
            AssetBundleLoadAssetOperation assetLoad = operation as AssetBundleLoadAssetOperation;
            HttpLoadOperation             httpLoad;

            if (assetLoad != null)
            {
                loadingTasks.Remove(req);
                isError = assetLoad.error != null;
                SetCacheAsset(req);        // set asset cache
                DispatchAssetBundleLoadAssetOperation(req, isError);
                assetLoad.ReleaseToPool(); //relase AssetBundleLoadAssetOperation

                //等两帧再CheckAllComplete
                allCompleteCheckCount = 0.1f;
                //CheckAllComplete();//check all complete
            }
            else if ((httpLoad = operation as HttpLoadOperation) != null)
            {
                isError   = !string.IsNullOrEmpty(httpLoad.error);
                req.error = httpLoad.error;

                if (isError && CUtils.IsResolveHostError(httpLoad.error) && !CUtils.IsHttps(req.url))// http dns
                {
                    httpLoad.error = string.Format("dns resolve error url={0} ", req.url);
                    var httpDnsOp = HttpDnsResolve.Get();
                    httpDnsOp.SetRequest(req);
                    httpDnsOp.SetOriginalOperation(httpLoad);
                    inProgressOperations.Add(httpDnsOp);
                }
                else if (isError && UriGroup.CheckAndSetNextUriGroup(req)) //多域名
                {
#if HUGULA_LOADER_DEBUG
                    HugulaDebug.FilterLogFormat(req.key, "<color=#10f010>1.9  ProcessFinishedOperation re Loaded Request(url={0},assetname={1},dependencies.count={3},keyHashCode{2}),isError={4} frameCount{5}</color>", req.url, req.assetName, req.keyHashCode, req.dependencies == null ? 0 : req.dependencies.Length, isError, Time.frameCount);
#endif
                    // Debug.LogFormat(" re try {0};",req.url);
                    inProgressOperations.Add(httpLoad);
                    httpLoad.Reset();
                    httpLoad.SetRequest(req);
                    httpLoad.BeginDownload(); //retry
                }
                else
                {
                    httpLoad.ReleaseToPool();

                    if (isError)
                    {
                        req.DispatchEnd();
                    }
                    else
                    {
                        req.DispatchComplete();
                    }

                    if (req.group != null)
                    {
                        req.group.Complete(req, isError);
                    }

                    req.ReleaseToPool();
                }
            }
            else
            {
                operation.ReleaseToPool();
            }
        }