热更新时,第一次进入时load本地的manifest文件,运行时只显示更新到资源,没执行更新后脚本,第二次进入时从缓存中获取manifest文件,在缓存中脚本和资源都更新了,查看缓存中project.dev.js 代码有更改。但是运行时没执行更新后的脚本和资源. jsb.fileUtils.getSearchPaths() 缓存中也有cc.Info.storage所指定的路径 ,求大神指点一下
path::: 0 C:/Users/Administrator/AppData/Local/Games/Games-assets/Game1/
path::: 1 C:/Users/Administrator/AppData/Local/Games/Games-assets/
path::: 2 F:/cocosCreator/project/GameFile/Games/build/jsb-link/frameworks/runtime-src/proj.win32/Debug.win32/res/raw-assets/
path::: 3 F:/cocosCreator/project/GameFile/Games/build/jsb-link/frameworks/runtime-src/proj.win32/Debug.win32/
manifestLoad.js:
var _processFunc = this.processFunc.bind(this);
var _completeFunc = this.completeFunc.bind(this);
var url_path = (jsb.fileUtils ? jsb.fileUtils.getWritablePath() :"/") + cc.Info.storage + “project.manifest”;
//如果缓存中manifest存在,则直接进行热更新
if(jsb.fileUtils.isFileExist(url_path))
{
cc.Info.url = url_path;
cc.director.loadScene(“subLoading”);
}else{ //将本地的manifest文件写到指定的缓存中
cc.loader.load(cc.url.raw(cc.Info.manifest),_processFunc,_completeFunc);
}
hotUpdate.js:
start:function()
{
this.info = cc.Info;
var self = this;
if(!cc.sys.isNative)
{
return;
}
this.manifestUrl = cc.Info.url;
var storagePath = (jsb.fileUtils?jsb.fileUtils.getWritablePath():"/") + this.info.storage;
this._am = new jsb.AssetsManager(this.manifestUrl,storagePath);
//更新成功后跳转
nextScene:function()
{
// cc.director.preloadScene(“sceneName”, function(){
//
// });
cc.director.loadScene(cc.Info.fire);
},