mirror of
https://github.com/photonstorm/phaser
synced 2024-12-26 04:53:38 +00:00
665b295c3b
Also updated the physicsManager to make it a lot more cleaner and easy to adjust in future
59 lines
1.2 KiB
JavaScript
59 lines
1.2 KiB
JavaScript
var Start = function (key, data)
|
|
{
|
|
if (data === undefined) { data = {}; }
|
|
|
|
// if not booted, then put scene into a holding pattern
|
|
if (!this.game.isBooted)
|
|
{
|
|
for (var i = 0; i < this._pending.length; i++)
|
|
{
|
|
var entry = this._pending[i];
|
|
|
|
if (entry.key === key)
|
|
{
|
|
entry.autoStart = true;
|
|
entry.data = data;
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
var scene = this.getScene(key);
|
|
|
|
if (scene)
|
|
{
|
|
// Already started? Nothing more to do here ...
|
|
if (this.isActive(key))
|
|
{
|
|
return;
|
|
}
|
|
|
|
scene.sys.start(data);
|
|
|
|
var loader = scene.sys.load;
|
|
|
|
// Files payload?
|
|
if (loader && Array.isArray(scene.sys.settings.files))
|
|
{
|
|
loader.reset();
|
|
|
|
if (loader.loadArray(scene.sys.settings.files))
|
|
{
|
|
loader.events.once('LOADER_COMPLETE_EVENT', this.payloadComplete.bind(this));
|
|
|
|
loader.start();
|
|
}
|
|
else
|
|
{
|
|
this.bootScene(scene);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.bootScene(scene);
|
|
}
|
|
}
|
|
};
|
|
|
|
module.exports = Start;
|