mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
SceneManager uses new internal boot queue.
This commit is contained in:
parent
23285896c0
commit
7c16368d3e
1 changed files with 65 additions and 1 deletions
|
@ -119,10 +119,74 @@ var SceneManager = new Class({
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only need to wait for the boot event if we've scenes to actually boot
|
// Only need to wait for the boot event if we've scenes to actually boot
|
||||||
game.events.once('ready', this.processQueue, this);
|
game.events.once('ready', this.bootQueue, this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal first-time Scene boot handler.
|
||||||
|
*
|
||||||
|
* @method Phaser.Scenes.SceneManager#bootQueue
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
bootQueue: function ()
|
||||||
|
{
|
||||||
|
var i;
|
||||||
|
var entry;
|
||||||
|
var key;
|
||||||
|
var sceneConfig;
|
||||||
|
|
||||||
|
for (i = 0; i < this._pending.length; i++)
|
||||||
|
{
|
||||||
|
entry = this._pending[i];
|
||||||
|
|
||||||
|
key = entry.key;
|
||||||
|
sceneConfig = entry.scene;
|
||||||
|
|
||||||
|
var newScene;
|
||||||
|
|
||||||
|
if (sceneConfig instanceof Scene)
|
||||||
|
{
|
||||||
|
newScene = this.createSceneFromInstance(key, sceneConfig);
|
||||||
|
}
|
||||||
|
else if (typeof sceneConfig === 'object')
|
||||||
|
{
|
||||||
|
sceneConfig.key = key;
|
||||||
|
|
||||||
|
newScene = this.createSceneFromObject(key, sceneConfig);
|
||||||
|
}
|
||||||
|
else if (typeof sceneConfig === 'function')
|
||||||
|
{
|
||||||
|
newScene = this.createSceneFromFunction(key, sceneConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace key in case the scene changed it
|
||||||
|
key = newScene.sys.settings.key;
|
||||||
|
|
||||||
|
this.keys[key] = newScene;
|
||||||
|
|
||||||
|
this.scenes.push(newScene);
|
||||||
|
|
||||||
|
if (entry.autoStart || newScene.sys.settings.active)
|
||||||
|
{
|
||||||
|
this._start.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the pending lists
|
||||||
|
this._pending.length = 0;
|
||||||
|
|
||||||
|
// _start might have been populated by the above
|
||||||
|
for (i = 0; i < this._start.length; i++)
|
||||||
|
{
|
||||||
|
entry = this._start[i];
|
||||||
|
|
||||||
|
this.start(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._start.length = 0;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* [description]
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue