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(); } },