예제 #1
0
        private static void loadPackVersionOver()
        {
            BytesReadStream stream = _loader.getBytesRead();

            if (stream != null && stream.checkVersion(ShineGlobal.versionInfoVersion))
            {
                _packVersionData = new VersionSaveData();
                _packVersionData.readBytes(stream);
            }

            _loader.unload();

            //初次下载
            if (_versionData == null)
            {
                _versionData = _packVersionData;

                if (_versionData == null)
                {
                    ShineSetup.exit("没有可用的versionInfo数据,请重新打包");
                    return;
                }

                makeVersionFirst();
            }
            //更新app或调试版
            else if (_packVersionData.resourceVersion > _versionData.resourceVersion || !_packVersionData.isRelease)
            {
                if (!ShineSetting.isRelease && ShineSetting.needDebugResourceVersion)
                {
                    //其他动作
                }
                else
                {
                    //新包覆盖
                    if (ShineSetting.newPackNeedCover)
                    {
                        _versionData = _packVersionData;
                        // deleteAllCache();
                        deleteAllPackageCache();
                        makeVersionFirst();
                    }
                    else
                    {
                        mergeVersion(_packVersionData);
                        checkResourceExists();
                    }
                }
            }

            Action func = _overCall;

            _overCall = null;

            if (func != null)
            {
                func();
            }
        }
예제 #2
0
        /** 加载资源信息同步(forEditor) */
        public static void loadBundleInfoSync()
        {
            BytesReadStream stream = FileUtils.readFileForBytesReadStream(getStreamingAssetsPath(ShineGlobal.bundleInfoPath, false));

            //存在才加载
            if (stream != null && stream.checkVersion(ShineGlobal.bundleInfoVersion))
            {
                readBundleInfo(stream);
            }
        }
예제 #3
0
        /** 读取本地版本数据(如已存在则不再读取) */
        public static void loadVersion(Action overFunc)
        {
            if (_versionData != null)
            {
                if (overFunc != null)
                {
                    overFunc();
                }
                return;
            }

            _overCall = overFunc;

            BytesReadStream stream = FileUtils.readFileForBytesReadStream(_versionPath);

            //存在
            if (stream != null && stream.checkVersion(ShineGlobal.versionInfoVersion))
            {
                _versionData = new VersionSaveData();
                _versionData.readBytes(stream);

                //本地纠正
                if (!ShineSetting.isRelease)
                {
                    makeVersionFirst();
                }
            }
            else
            {
                _versionData = null;
            }

            if (!ShineSetting.isRelease && ShineSetting.localLoadWithOutBundle)
            {
                if (_versionData == null)
                {
                    _versionData                 = new VersionSaveData();
                    _versionData.appVersion      = 1;
                    _versionData.resourceVersion = 1;
                    _versionData.version         = "1.01";
                }

                if (overFunc != null)
                {
                    overFunc();
                }
                return;
            }

            _loader.setCompleteCall(loadPackVersionOver);
            _loader.loadStreamingAsset(ShineGlobal.versionInfoPath);
        }
예제 #4
0
        private static void loadCDNVersionOver()
        {
            BytesReadStream stream = _loader.getBytesRead();

            VersionSaveData data = null;

            if (stream != null && stream.checkVersion(ShineGlobal.versionInfoVersion))
            {
                data = new VersionSaveData();
                data.readBytes(stream);
            }

            _loader.unload();

            Action <VersionSaveData> func = _overCall2;

            _overCall2 = null;

            if (func != null)
            {
                func(data);
            }
        }
예제 #5
0
        private static void initOver()
        {
            BytesReadStream stream = _loader.getBytesRead();

            //检测版本
            if (!stream.checkVersion(ShineGlobal.bundleInfoVersion))
            {
                ShineSetup.exit("bundleInfo结构版本检测不对");
                return;
            }

            readBundleInfo(stream);

            _loader.unload();

            Action func = _overCall;

            _overCall = null;

            if (func != null)
            {
                func();
            }
        }