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