mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Merge pull request #5825 from ubershmekel/master
Fix #5811, log error on invalid scene.start(key)
This commit is contained in:
commit
9adcd5c615
1 changed files with 48 additions and 45 deletions
|
@ -1151,54 +1151,57 @@ var SceneManager = new Class({
|
|||
|
||||
var scene = this.getScene(key);
|
||||
|
||||
if (scene)
|
||||
if (!scene)
|
||||
{
|
||||
var sys = scene.sys;
|
||||
|
||||
// If the Scene is already running (perhaps they called start from a launched sub-Scene?)
|
||||
// then we close it down before starting it again.
|
||||
if (sys.isActive() || sys.isPaused())
|
||||
{
|
||||
sys.shutdown();
|
||||
|
||||
sys.sceneUpdate = NOOP;
|
||||
|
||||
sys.start(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
sys.sceneUpdate = NOOP;
|
||||
|
||||
sys.start(data);
|
||||
|
||||
var loader;
|
||||
|
||||
if (sys.load)
|
||||
{
|
||||
loader = sys.load;
|
||||
}
|
||||
|
||||
// Files payload?
|
||||
if (loader && sys.settings.hasOwnProperty('pack'))
|
||||
{
|
||||
loader.reset();
|
||||
|
||||
if (loader.addPack({ payload: sys.settings.pack }))
|
||||
{
|
||||
sys.settings.status = CONST.LOADING;
|
||||
|
||||
loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this);
|
||||
|
||||
loader.start();
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.bootScene(scene);
|
||||
console.warn('Scene not found for key: ' + key);
|
||||
return this;
|
||||
}
|
||||
|
||||
var sys = scene.sys;
|
||||
|
||||
// If the Scene is already running (perhaps they called start from a launched sub-Scene?)
|
||||
// then we close it down before starting it again.
|
||||
if (sys.isActive() || sys.isPaused())
|
||||
{
|
||||
sys.shutdown();
|
||||
|
||||
sys.sceneUpdate = NOOP;
|
||||
|
||||
sys.start(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
sys.sceneUpdate = NOOP;
|
||||
|
||||
sys.start(data);
|
||||
|
||||
var loader;
|
||||
|
||||
if (sys.load)
|
||||
{
|
||||
loader = sys.load;
|
||||
}
|
||||
|
||||
// Files payload?
|
||||
if (loader && sys.settings.hasOwnProperty('pack'))
|
||||
{
|
||||
loader.reset();
|
||||
|
||||
if (loader.addPack({ payload: sys.settings.pack }))
|
||||
{
|
||||
sys.settings.status = CONST.LOADING;
|
||||
|
||||
loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this);
|
||||
|
||||
loader.start();
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.bootScene(scene);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue