Skip to content

Commit a01726f

Browse files
committed
Fix Scene Add Data
Data was not being passed in to the scene manager when adding a scene via `add`.
1 parent e34d759 commit a01726f

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

src/scene/ScenePlugin.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ var ScenePlugin = new Class({
210210
*
211211
* @method Phaser.Scenes.ScenePlugin#restart
212212
* @since 3.4.0
213-
*
213+
*
214214
* @param {object} [data] - The Scene data.
215215
*
216216
* @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object.
@@ -227,7 +227,7 @@ var ScenePlugin = new Class({
227227

228228
/**
229229
* @typedef {object} Phaser.Scenes.ScenePlugin.SceneTransitionConfig
230-
*
230+
*
231231
* @property {string} target - The Scene key to transition to.
232232
* @property {integer} [duration=1000] - The duration, in ms, for the transition to last.
233233
* @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`)
@@ -241,24 +241,24 @@ var ScenePlugin = new Class({
241241

242242
/**
243243
* This will start a transition from the current Scene to the target Scene given.
244-
*
244+
*
245245
* The transition will last for the duration specified in milliseconds.
246-
*
246+
*
247247
* You can have the target Scene moved above or below this one in the display list.
248-
*
248+
*
249249
* You can specify an update callback. This callback will be invoked _every frame_ for the duration
250250
* of the transition.
251251
*
252252
* This Scene can either be sent to sleep at the end of the transition, or stopped. The default is to stop.
253-
*
253+
*
254254
* There are also 5 transition related events: This scene will emit the event `transitionto` when
255255
* the transition begins, which is typically the frame after calling this method.
256-
*
256+
*
257257
* The target Scene will emit the event `transitioninit` when that Scene's `init` method is called.
258258
* It will then emit the event `transitionstart` when its `create` method is called.
259259
* If the Scene was sleeping and has been woken up, it will emit the event `transitionwake` instead of these two,
260260
* as the Scenes `init` and `create` methods are not invoked when a Scene wakes up.
261-
*
261+
*
262262
* When the duration of the transition has elapsed it will emit the event `transitioncomplete`.
263263
* These events are cleared of all listeners when the Scene shuts down, but not if it is sent to sleep.
264264
*
@@ -268,7 +268,7 @@ var ScenePlugin = new Class({
268268
* this Scenes update loop to stop, then the transition will also pause for that duration. There are
269269
* checks in place to prevent you accidentally stopping a transitioning Scene but if you've got code to
270270
* override this understand that until the target Scene completes it might never be unlocked for input events.
271-
*
271+
*
272272
* @method Phaser.Scenes.ScenePlugin#transition
273273
* @since 3.5.0
274274
*
@@ -443,12 +443,13 @@ var ScenePlugin = new Class({
443443
* @param {string} key - The Scene key.
444444
* @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene.
445445
* @param {boolean} autoStart - Whether to start the Scene after it's added.
446+
* @param {object} [data] - The Scene data.
446447
*
447448
* @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object.
448449
*/
449-
add: function (key, sceneConfig, autoStart)
450+
add: function (key, sceneConfig, autoStart, data)
450451
{
451-
this.manager.add(key, sceneConfig, autoStart);
452+
this.manager.add(key, sceneConfig, autoStart, data);
452453

453454
return this;
454455
},
@@ -476,7 +477,7 @@ var ScenePlugin = new Class({
476477

477478
/**
478479
* Runs the given Scene, but does not change the state of this Scene.
479-
*
480+
*
480481
* If the given Scene is paused, it will resume it. If sleeping, it will wake it.
481482
* If not running at all, it will be started.
482483
*

0 commit comments

Comments
 (0)