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
33 lines
703 B
JavaScript
33 lines
703 B
JavaScript
var Scene = require('../../local/Scene');
|
|
|
|
// private
|
|
var GetKey = function (key, sceneConfig)
|
|
{
|
|
if (!key) { key = 'default'; }
|
|
|
|
if (typeof sceneConfig === 'function')
|
|
{
|
|
return key;
|
|
}
|
|
else if (sceneConfig instanceof Scene)
|
|
{
|
|
key = sceneConfig.sys.settings.key;
|
|
}
|
|
else if (typeof sceneConfig === 'object' && sceneConfig.hasOwnProperty('key'))
|
|
{
|
|
key = sceneConfig.key;
|
|
}
|
|
|
|
// By this point it's either 'default' or extracted from the Scene
|
|
|
|
if (this.keys.hasOwnProperty(key))
|
|
{
|
|
throw new Error('Cannot add a Scene with duplicate key: ' + key);
|
|
}
|
|
else
|
|
{
|
|
return key;
|
|
}
|
|
};
|
|
|
|
module.exports = GetKey;
|