2018-02-12 16:01:20 +00:00
|
|
|
/**
|
2024-02-19 17:12:18 +00:00
|
|
|
* @author Richard Davey <rich@phaser.io>
|
|
|
|
* @copyright 2013-2024 Phaser Studio Inc.
|
2019-05-10 15:15:04 +00:00
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
2018-02-12 16:01:20 +00:00
|
|
|
*/
|
|
|
|
|
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;
|