mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-26 11:48:29 +00:00
[adapters] 修复未同步 cacheFiles 的问题,并降低通信消耗
This commit is contained in:
parent
cf7307d7f5
commit
290b29770c
@ -16,11 +16,8 @@ var assetManagerWorkerAdapter = {
|
|||||||
},
|
},
|
||||||
// 添加缓存文件记录
|
// 添加缓存文件记录
|
||||||
addCachedFiles(args, cmdId, callback) {
|
addCachedFiles(args, cmdId, callback) {
|
||||||
const addedFiles = args[0];
|
const [id, cacheBundleRoot, localPath, time] = args[0];
|
||||||
for (let i = 0, l = addedFiles.length; i < l; i++) {
|
cc.assetManager.cacheManager.cachedFiles.add(id, { bundle: cacheBundleRoot, url: localPath, lastTime: time });
|
||||||
const [id, cacheBundleRoot, localPath, time] = addedFiles[i];
|
|
||||||
cc.assetManager.cacheManager.cachedFiles.add(id, { bundle: cacheBundleRoot, url: localPath, lastTime: time });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ var cacheManager_worker = {
|
|||||||
self.cachedFiles[id] = { bundle: cacheBundleRoot, url: localPath, lastTime: time };
|
self.cachedFiles[id] = { bundle: cacheBundleRoot, url: localPath, lastTime: time };
|
||||||
delete self.cacheQueue[id];
|
delete self.cacheQueue[id];
|
||||||
self.writeCacheFile();
|
self.writeCacheFile();
|
||||||
// TODO main.assetManager.addCachedFiles([[id, cacheBundleRoot, localPath, time]]);
|
main.assetManager.addCachedFiles([id, cacheBundleRoot, localPath, time]);
|
||||||
if (_callback) _callback(id, cacheBundleRoot, localPath, time);
|
if (_callback) _callback(id, cacheBundleRoot, localPath, time);
|
||||||
}
|
}
|
||||||
if (!isEmptyObject(self.cacheQueue)) {
|
if (!isEmptyObject(self.cacheQueue)) {
|
||||||
@ -334,7 +334,7 @@ var cacheManager_worker = {
|
|||||||
}
|
}
|
||||||
self.cachedFiles[id] = { bundle: cacheBundleRoot, url: targetPath, lastTime: time };
|
self.cachedFiles[id] = { bundle: cacheBundleRoot, url: targetPath, lastTime: time };
|
||||||
self.writeCacheFile();
|
self.writeCacheFile();
|
||||||
main.assetManager.addCachedFiles([[id, cacheBundleRoot, targetPath, time]]);
|
main.assetManager.addCachedFiles([id, cacheBundleRoot, targetPath, time]);
|
||||||
onComplete && onComplete(null, targetPath);
|
onComplete && onComplete(null, targetPath);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user