ScenePlugin.restart allows you to restart the current Scene. It's the same result as calling ScenePlugin.start without any arguments, but is more clear.

This commit is contained in:
Richard Davey 2018-04-09 12:56:28 +01:00
parent 1a3d4330ac
commit bf368ab70b

View file

@ -121,6 +121,34 @@ var ScenePlugin = new Class({
return this;
},
/**
* Restarts this Scene.
*
* @method Phaser.Scenes.ScenePlugin#restart
* @since 3.4.0
*
* @param {object} [data] - The Scene data.
*
* @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object.
*/
restart: function (data)
{
var key = this.key;
if (this.settings.status !== CONST.RUNNING)
{
this.manager.queueOp('stop', key);
this.manager.queueOp('start', key, data);
}
else
{
this.manager.stop(key);
this.manager.start(key, data);
}
return this;
},
/**
* Add the Scene into the Scene Manager and start it if 'autoStart' is true or the Scene config 'active' property is set.
*