1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- const SceneCtrlBase = require('SceneCtrlBase');
- // 版本更新
- // 主要控制显示那种版本更新布局
- cc.Class({
- extends: SceneCtrlBase,
- editor: {
- menu: 'Launch/VersionUpdateCtrl'
- },
- start () {
- this._super();
- this.isDownloadFinish = G.RemoteUpdateInfoMgr.isDownloadFinish;
- let remoteUpdateInfo = G.RemoteUpdateInfoMgr.remoteUpdateInfo;
- // 有无更新奖励判断
- this.haveAward = remoteUpdateInfo.newAppAward == '' ? false : true;
- // 有无banner判断
- this.haveBanner = remoteUpdateInfo.newAppBanner == '' ? false : true;
- // 是否强制更新判断
- this.isForceUpdate = remoteUpdateInfo.newAppForce == 0 ? false : true;
- // 是否静默更新判断
- this.isSilentUpdate = remoteUpdateInfo.newAppSilence == 0 ? false : true;
- let needSilence = false;
- // 静默更新判断
- if (!this.isDownloadFinish && this.isForceUpdate == false && this.isSilentUpdate == true) {
- needSilence = true;
- }
- let updateType = 0;
- // 显示 无奖励 无banner 布局
- if (this.haveAward == false && this.haveBanner == false) {
- updateType = 1;
- }
- // 显示 有奖励 无banner 布局
- else if (this.haveAward == true && this.haveBanner == false) {
- updateType = 2;
- }
- // 显示 无奖励 有banner 布局
- else if (this.haveAward == false && this.haveBanner == true) {
- updateType = 3;
- }
- // 显示 有奖励 有banner 布局
- else if (this.haveAward == true && this.haveBanner == true) {
- updateType = 4;
- }
- if (needSilence || (updateType === 0)){
- G.AppUtils.loadScene('scene_login');
- } else {
- cc.game.emit('e_launch_update_show_alert');
- }
- cc.game.on('e_launch_enter_scene', this.handleEnterScene, this);
- },
- handleEnterScene () {
- G.AppUtils.loadScene('scene_login');
- }
- });
|