Beispiel #1
0
        public bool update(float detlaTime)
        {
            if (!_completed)
            {
                if (_completed = (_wwwRequest != null && _wwwRequest.isDone))
                {
                    try
                    {
                        if (_wwwRequest.error == null)
                        {
                            _item.LoadCompleteHandler(_wwwRequest.assetBundle);
                        }
                        else
                        {
                            _item.LoadErrorHandler();
                            Debug.Log(string.Format("[Error]{0}  [URL]{1}", _wwwRequest.error, _wwwRequest.url));
                        }
                    }
                    catch
                    {
                        _item.LoadErrorHandler();
                    }
                    finally
                    {
                        if (_wwwRequest.responseHeaders.ContainsKey("CONTENT-LENGTH"))
                        {
                            _item.GetLoadingDataLength(_wwwRequest.responseHeaders["CONTENT-LENGTH"]);
                        }
                        else
                        {
                            string param = "0";
                            _item.GetLoadingDataLength(param);
                        }

                        _wwwRequest.Dispose();
                        _wwwRequest = null;

                        _item = null;
                    }
                }
                else
                {
                    //未完成,更新进度
                    //_wwwRequest.progress
                    _item.GetLoadingProgress(_wwwRequest.progress);
                }
            }

            return(_completed);
        }
Beispiel #2
0
        public bool Update(float detlaTime)
        {
            if (resourceRequest != null && resourceRequest.isDone)
            {
                loadingResource = resourceRequest.asset;
                isCompleted     = true;

                if (loadingResource == null)
                {
                    DebugUtils.LogError(DebugUtils.Type.Resource, string.Format("Load local resousrce faild, Path = {0}", this.item.URL));
                }
                item.LoadCompleteHandler(loadingResource);
                resourceRequest = null;
            }
            return(isCompleted);
        }