2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2019-01-15 16:20:22 +00:00
|
|
|
* @copyright 2019 Photon Storm Ltd.
|
2018-02-12 16:01:20 +00:00
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
2018-01-18 05:20:57 +00:00
|
|
|
var GetFastValue = require('../utils/object/GetFastValue');
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Builds an array of which plugins (not including physics plugins) should be activated for the given Scene.
|
|
|
|
*
|
|
|
|
* @function Phaser.Scenes.GetScenePlugins
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-10-19 11:32:43 +00:00
|
|
|
* @param {Phaser.Scenes.Systems} sys - The Scene Systems object to check for plugins.
|
2018-02-12 15:18:31 +00:00
|
|
|
*
|
2018-10-19 11:32:43 +00:00
|
|
|
* @return {array} An array of all plugins which should be activated, either the default ones or the ones configured in the Scene Systems object.
|
2018-02-12 15:18:31 +00:00
|
|
|
*/
|
2018-01-18 05:20:57 +00:00
|
|
|
var GetScenePlugins = function (sys)
|
|
|
|
{
|
2018-05-11 15:00:46 +00:00
|
|
|
var defaultPlugins = sys.plugins.getDefaultScenePlugins();
|
|
|
|
|
2018-01-18 05:20:57 +00:00
|
|
|
var scenePlugins = GetFastValue(sys.settings, 'plugins', false);
|
|
|
|
|
|
|
|
// Scene Plugins always override Default Plugins
|
|
|
|
if (Array.isArray(scenePlugins))
|
|
|
|
{
|
|
|
|
return scenePlugins;
|
|
|
|
}
|
|
|
|
else if (defaultPlugins)
|
|
|
|
{
|
|
|
|
return defaultPlugins;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// No default plugins or plugins in this scene
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = GetScenePlugins;
|