From 059d874600aea73a258d0163073aba1a6b24da81 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 23 Mar 2019 00:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=83=AD=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HotUpdateDemo/assets/Script/HotUpdate.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/HotUpdateDemo/assets/Script/HotUpdate.js b/HotUpdateDemo/assets/Script/HotUpdate.js index 8581f39..490ff8d 100644 --- a/HotUpdateDemo/assets/Script/HotUpdate.js +++ b/HotUpdateDemo/assets/Script/HotUpdate.js @@ -256,6 +256,8 @@ cc.Class({ updateCb: function (event) { var needRestart = false; var failed = false; + var aleardyUpdate = false; + switch (event.getEventCode()) { case jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST: // this.panel.info.string = 'No local manifest file found, hot update skipped.'; @@ -273,6 +275,7 @@ cc.Class({ case jsb.EventAssetsManager.ALREADY_UP_TO_DATE: // this.panel.info.string = 'Already up to date with the latest remote version.'; failed = true; + aleardyUpdate = true; break; case jsb.EventAssetsManager.UPDATE_FINISHED: // console.log('UPDATE_FINISHED'); @@ -294,16 +297,14 @@ cc.Class({ break; } - //下载失败 + //下载失败 if (failed) { // console.log('Hotupdate failure'); this.onFailure(ErrCode.updateFailed); cc.eventManager.removeListener(this._updateListener); this._updateListener = null; this._updating = false; - } - - if (needRestart) { + } else if (needRestart) { // console.log('Hotupdate success'); cc.eventManager.removeListener(this._updateListener); this._updateListener = null; @@ -314,6 +315,9 @@ cc.Class({ jsb.fileUtils.setSearchPaths(searchPaths); cc.audioEngine.stopAll(); cc.game.restart(); + } else if (aleardyUpdate) { + //进入游戏 + this.onEnterGame(); } },