Commit 5fa38b63 authored by liujiangnan's avatar liujiangnan

feat: 加载bundle

parent 9c8c34cd
......@@ -52,7 +52,7 @@ cc.Class({
// 只加载一次就行了
window.preloadBundleAndSourcesFlag = true;
cc.find("middleLayer/ui/ProgressLabel").active = true;
// this.preloadBundle();
this.preloadBundle();
this.preloadSource();
}
},
......@@ -102,10 +102,34 @@ cc.Class({
});
},
batchPreloadScene(scenes) {
const expects = [
'op_09', 'OP05',
'OP_03', 'op_01',
'LWD_3', 'op_07',
'op_02', 'OP_08',
'op_06_1', 'OP10',
'op_09_plus', 'OP11',
'OP10_online', 'OP12',
'OP13', 'OP_03_1',
'OSMO_01', 'OP15',
'OPW25', 'OP_03_2',
'op_06_2', 'OP_06_3'
];
const _this = this;
let i = 0;
const load = function () {
const scene = scenes[i];
if(expects.includes(scene.sceneName)){
_this.loadedCount++;
_this.updateProcessBar();
i++;
if (i < scenes.length) {
setTimeout(() => {
load();
}, 1);
}
return;
}
cc.assetManager.loadBundle(scene.bondleUrl, { version: scene.version }, (err, bundle) => {
console.log(`${scene.bondleUrl}---场景开始loadBundle----`);
bundle.preloadScene(scene.sceneName, () => { }, () => {
......
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