Skip to content

Commit e29e350

Browse files
committed
Made cc.LoaderScene compatible with runtime LoaderLayer
1 parent c8427ee commit e29e350

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

extensions/runtime/CCLoaderLayer.js

+22-7
Original file line numberDiff line numberDiff line change
@@ -421,20 +421,20 @@ cc.LoaderLayer.preload = function (groupname, callback, target) {
421421
}
422422
}
423423
var callPreload = function () {
424-
if (cc.director.getRunningScene()) {
425-
loaderLayer.updateGroup(groupname, preloadCb, target);
426-
loaderLayer._addToScene();
427-
loaderLayer._preloadSource();
428-
} else {
429-
cc.log("Current scene is null we can't start preload");
430-
}
424+
loaderLayer.updateGroup(groupname, preloadCb, target);
425+
loaderLayer._addToScene();
426+
loaderLayer._preloadSource();
431427
};
432428

433429
if (res_engine_loaded) {
434430
callPreload();
435431
return;
436432
}
437433

434+
if (!cc.director.getRunningScene()) {
435+
cc.director.runScene(new cc.Scene());
436+
}
437+
438438
// Res engine not loaded, load them
439439
cc.loader.load([
440440
GROUP_JSON_PATH,
@@ -972,3 +972,18 @@ cc.network.preloadstatus = {
972972
cc.runtime.network = cc.network;
973973

974974
})();
975+
976+
cc.LoaderScene._preload = cc.LoaderScene.preload;
977+
cc.LoaderScene.preload = function (arr, cb, target) {
978+
// No extension
979+
var isGroups = (arr[0] && arr[0].indexOf('.') === -1);
980+
if (isGroups) {
981+
if (arr.indexOf('boot') === -1) {
982+
arr.splice(0, 0, 'boot');
983+
}
984+
cc.LoaderLayer.preload(arr, cb, target);
985+
}
986+
else {
987+
cc.LoaderScene._preload(arr, cb, target);
988+
}
989+
}

0 commit comments

Comments
 (0)