Skip to content

Commit e6d7a8e

Browse files
committed
PluginFile will now install the plugin into the _current_ Scene as long as the start or mapping arguments are provided.
1 parent 5da7707 commit e6d7a8e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/loader/filetypes/PluginFile.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ var PluginFile = new Class({
122122

123123
document.head.appendChild(this.data);
124124

125-
pluginManager.install(this.key, window[this.key], start, mapping);
125+
var plugin = pluginManager.install(this.key, window[this.key], start, mapping);
126+
127+
if (start || mapping)
128+
{
129+
// Install into the current Scene Systems and Scene
130+
this.loader.systems[mapping] = plugin;
131+
this.loader.scene[mapping] = plugin;
132+
}
126133
}
127134

128135
this.onProcessComplete();
@@ -183,7 +190,7 @@ var PluginFile = new Class({
183190
*
184191
* @param {(string|Phaser.Loader.FileTypes.PluginFileConfig|Phaser.Loader.FileTypes.PluginFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
185192
* @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `<key>.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, a plugin function.
186-
* @param {boolean} [start] - The plugin mapping configuration object.
193+
* @param {boolean} [start] - Automatically start the plugin after loading?
187194
* @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used.
188195
* @param {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings.
189196
*

0 commit comments

Comments
 (0)