예제 #1
0
    /** 继续使用当前的app版本 */
    private void continueCurrentApp(VersionSaveData localVersionData)
    {
        //当前版本够
        if (localVersionData.resourceVersion >= _versionData.currentResourceVersion)
        {
            doVersionNext(true);
        }
        else
        {
            //读取cdn版本
            ResourceInfoControl.loadCDNVersion(_versionData.currentResourceVersion, cdnVersion =>
            {
                //需要强制资源更新或之前未完全更完
                if (localVersionData.resourceVersion < _versionData.leastResourceVersion || !ResourceInfoControl.isVersionDataReady())
                {
                    ResourceInfoControl.mergeVersion(cdnVersion);
                    doVersionNext(true);
                    return;
                }

                //计算更新量
                ResourceInfoControl.countNewVersionSize(cdnVersion, _versionRe);

                _downloadSize = StringUtils.toMBString(_versionRe.size);

                //更新资源选择
                showAlertInWifi(Alert_GetNewResource, () =>
                {
                    ResourceInfoControl.mergeVersion(cdnVersion);
                    doVersionNext(false);
                }, versionUpdateOver);
            });
        }
    }
예제 #2
0
    private void hotfixNext(ClientVersionData vData)
    {
        //读取cdn版本
        ResourceInfoControl.loadCDNVersion(vData.currentResourceVersion, sData =>
        {
            //计算更新量
            ResourceInfoControl.countNewVersionSize(sData, _versionRe);

            //只有配置
            if (_versionRe.isOnlyConfig)
            {
                ResourceInfoControl.mergeVersion(sData);
                doVersionNext(false, () =>
                {
                    if (GameC.main != null)
                    {
                        //热更配置
                        GameC.main.reloadConfig();
                        GameC.main.hotfixOver();
                    }
                });
            }
            //返回登录界面开始热更
            else
            {
                VersionSaveData localVersionData = ResourceInfoControl.getVersion();

                _downloadSize = StringUtils.toMBString(_versionRe.size);

                //需要强制更新
                if (localVersionData.resourceVersion < vData.leastResourceVersion)
                {
                    //更新资源选择,这里是在游戏内,必须弹窗确认
                    showAlert(Alert_GetNewResourceMust, () =>
                    {
                        doHotFix(sData);
                    }, exitGame);
                }
                else
                {
                    //更新资源选择,这里是在游戏内,必须弹窗确认
                    showAlert(Alert_GetNewResource, () => { doHotFix(sData); }, () =>
                    {
                        if (GameC.main != null)
                        {
                            GameC.main.hotfixOver();
                        }
                    });
                }
            }
        });
    }