Beispiel #1
0
        /** io出错(1:wwwError,2:超时,3:不完整) */
        private void toIoError(int type)
        {
            //把www停了
            if (_www != null)
            {
                _www.Dispose();
                _www = null;
            }

            Ctrl.print("io出错:" + type, _url);

            //本地缓存资源被删除了
            if (_loadMethod == LoadMethodType.Resource && _currentSaveData != null && _currentSaveData.state == ResourceSaveStateType.Downloaded)
            {
                //改成cdn下载
                _currentSaveData.state = ResourceSaveStateType.None;
                ResourceInfoControl.versionModified();
                _useURL    = ResourceInfoControl.getCDNResourcePath(_url, _currentSaveData.version);
                _needCache = true;

                toReload();
            }
            else
            {
                if (_tryForever)
                {
                    //等2秒
                    _tryWaitTime = _ioErrorWaitTime;
                }
                else
                {
                    unload();

                    if (_ioErrorCall != null)
                    {
                        _ioErrorCall();
                    }
                }
            }
        }
Beispiel #2
0
        /** 缓存到持久化目录 */
        private void resourceCache()
        {
            if (ShineSetting.debugJumpResourceVersion)
            {
                return;
            }

            if (_www != null)
            {
                //缓存
                FileUtils.writeFileForBytes(ResourceInfoControl.getPersistentPath(_url, false), _www.bytes);
                _currentSaveData.state = ResourceSaveStateType.Downloaded;
                ResourceInfoControl.versionModified();
            }
            else if (_webRequest != null)
            {
                // _webRequest.
            }
            else
            {
                Ctrl.errorLog("ShineLoader,resourceCache时,没有可用对象");
            }
        }