forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetScenePlugins.js
More file actions
41 lines (36 loc) · 1.14 KB
/
Copy pathGetScenePlugins.js
File metadata and controls
41 lines (36 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var GetFastValue = require('../utils/object/GetFastValue');
/**
* 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
*
* @param {Phaser.Scenes.Systems} sys - The Scene Systems object to check for plugins.
*
* @return {array} An array of all plugins which should be activated, either the default ones or the ones configured in the Scene Systems object.
*/
var GetScenePlugins = function (sys)
{
var defaultPlugins = sys.plugins.getDefaultScenePlugins();
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;