Skip to content

Commit e431cc3

Browse files
committed
Moved plugins file to DefaultPlugins and changed the namespace
1 parent 2f4c52b commit e431cc3

4 files changed

Lines changed: 18 additions & 17 deletions

File tree

src/boot/Config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var GetValue = require('../utils/object/GetValue');
1111
var IsPlainObject = require('../utils/object/IsPlainObject');
1212
var MATH = require('../math/const');
1313
var NOOP = require('../utils/NOOP');
14-
var Plugins = require('../plugins');
14+
var DefaultPlugins = require('../plugins/DefaultPlugins');
1515
var ValueToColor = require('../display/color/ValueToColor');
1616

1717
/**
@@ -453,8 +453,8 @@ var Config = new Class({
453453
*
454454
* plugins: {
455455
* install: [
456-
* ModPlayerPlugin,
457-
* WireFramePlugin
456+
* { key: 'TestPlugin', plugin: TestPlugin, start: false, isScenePlugin: false },
457+
* { key: 'WireFramePlugin', plugin: WireFramePlugin, start: true, isScenePlugin: true }
458458
* ],
459459
* default: [], OR
460460
* defaultMerge: {
@@ -464,7 +464,7 @@ var Config = new Class({
464464
*/
465465

466466
var plugins = GetValue(config, 'plugins', null);
467-
var defaultPlugins = Plugins.DefaultScene;
467+
var defaultPlugins = DefaultPlugins.DefaultScene;
468468

469469
if (plugins)
470470
{
@@ -475,7 +475,7 @@ var Config = new Class({
475475
}
476476
else if (IsPlainObject(plugins))
477477
{
478-
// this.installPlugins.global = GetFastValue(plugins, 'install', []);
478+
this.installPlugins = GetFastValue(plugins, 'install', []);
479479

480480
if (Array.isArray(plugins.default))
481481
{
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55
*/
66

77
/**
8-
* @namespace Phaser.Plugins
8+
* @typedef {object} Phaser.Plugins.DefaultPlugins
9+
*
10+
* @property {array} Global - These are the Global Managers that are created by the Phaser.Game instance.
11+
* @property {array} CoreScene - These are the core plugins that are installed into every Scene.Systems instance, no matter what.
12+
* @property {array} DefaultScene - These plugins are created in Scene.Systems in addition to the CoreScenePlugins.
913
*/
10-
var Plugins = {
14+
15+
var DefaultPlugins = {
1116

1217
/**
1318
* These are the Global Managers that are created by the Phaser.Game instance.
@@ -80,10 +85,4 @@ var Plugins = {
8085

8186
};
8287

83-
/*
84-
* "Sometimes, the elegant implementation is just a function.
85-
* Not a method. Not a class. Not a framework. Just a function."
86-
* -- John Carmack
87-
*/
88-
89-
module.exports = Plugins;
88+
module.exports = DefaultPlugins;

src/plugins/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
module.exports = {
1212

13+
BasePlugin: require('./BasePlugin'),
14+
DefaultPlugins: require('./DefaultPlugins'),
1315
PluginManager: require('./PluginManager')
1416

1517
};

src/scene/Systems.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
var Class = require('../utils/Class');
88
var CONST = require('./const');
9+
var DefaultPlugins = require('../plugins/DefaultPlugins');
910
var GetPhysicsPlugins = require('./GetPhysicsPlugins');
1011
var GetScenePlugins = require('./GetScenePlugins');
11-
var Plugins = require('../plugins');
1212
var Settings = require('./Settings');
1313

1414
/**
@@ -233,9 +233,9 @@ var Systems = new Class({
233233

234234
this.plugins = pluginManager;
235235

236-
pluginManager.installGlobal(this, Plugins.Global);
236+
pluginManager.installGlobal(this, DefaultPlugins.Global);
237237

238-
pluginManager.installLocal(this, Plugins.CoreScene);
238+
pluginManager.installLocal(this, DefaultPlugins.CoreScene);
239239

240240
pluginManager.installLocal(this, GetScenePlugins(this));
241241

0 commit comments

Comments
 (0)