Skip to content

Commit

Permalink
Revert "refine engine prepare (cocos#5261)"
Browse files Browse the repository at this point in the history
This reverts commit 95bb663.
  • Loading branch information
PPpro committed Sep 2, 2019
1 parent a2bbda2 commit 50945db
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions cocos2d/core/CCGame.js
Expand Up @@ -384,16 +384,27 @@ var game = {
},

_prepareFinished (cb) {

if (CC_PREVIEW && window.__modular) {
window.__modular.run();
}
// Log engine version
console.log('Cocos Creator v' + cc.ENGINE_VERSION);


this._prepared = true;
this._runMainLoop();
this.emit(this.EVENT_GAME_INITED);
cb && cb();

// Init engine
this._initEngine();

this._setAnimFrame();
cc.AssetLibrary._loadBuiltins(() => {
// Log engine version
console.log('Cocos Creator v' + cc.ENGINE_VERSION);

this._runMainLoop();

this.emit(this.EVENT_GAME_INITED);

if (cb) cb();
});
},

eventTargetOn: EventTarget.prototype.on,
Expand Down Expand Up @@ -471,24 +482,19 @@ var game = {
if (cb) cb();
return;
}
let self = this;
// Init engine
this._initEngine();
this._setAnimFrame();
// Load builtin assets
cc.AssetLibrary._loadBuiltins(function () {
// Load game scripts
let jsList = self.config.jsList;
if (jsList && jsList.length > 0) {
cc.loader.load(jsList, function (err) {
if (err) throw new Error(JSON.stringify(err));
self._prepareFinished(cb);
});
}
else {

// Load game scripts
let jsList = this.config.jsList;
if (jsList && jsList.length > 0) {
var self = this;
cc.loader.load(jsList, function (err) {
if (err) throw new Error(JSON.stringify(err));
self._prepareFinished(cb);
}
});
});
}
else {
this._prepareFinished(cb);
}
},

/**
Expand Down

0 comments on commit 50945db

Please sign in to comment.