Commit 6ac4dd24 authored by liujiangnan's avatar liujiangnan

feat: 预加载

parent 13402734
......@@ -153,6 +153,9 @@ export default class NewClass extends middleLayerBase {
this.preloadCount += data.rows.length;
}
this.log('data.rows = ' + JSON.stringify(data.rows));
// const arr = data.rows.filter(item => item.sceneName ==='l2_boardgame2_tree');
// const arr1 = data.rows.filter(item => item.sceneName ==='BoardGame2');
// const resArr = [...arr, ...arr1];
this.batchPreloadScene(data.rows);
});
}
......@@ -179,28 +182,14 @@ export default class NewClass extends middleLayerBase {
}
cc.assetManager.loadBundle(scene.bondleUrl, { version: scene.version }, (err, bundle) => {
console.log(`${scene.bondleUrl}---场景开始loadBundle----`);
if (!bundle) {
_this.loadedCount++;
_this.updateProcessBar();
i++;
if (i < scenes.length) {
setTimeout(() => {
load();
}, 1);
}
return;
_this.loadedCount++;
_this.updateProcessBar();
i++;
if (i < scenes.length) {
setTimeout(() => {
load();
}, 1);
}
bundle.preloadScene(scene.sceneName, () => { }, () => {
console.log(`${scene.sceneName}场景预加载结束`);
_this.loadedCount++;
_this.updateProcessBar();
i++;
if (i < scenes.length) {
setTimeout(() => {
load();
}, 1);
}
});
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment