mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 05:58:30 +00:00
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:
parent
1a3d4330ac
commit
bf368ab70b
1 changed files with 28 additions and 0 deletions
|
@ -121,6 +121,34 @@ var ScenePlugin = new Class({
|
||||||
return this;
|
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.
|
* Add the Scene into the Scene Manager and start it if 'autoStart' is true or the Scene config 'active' property is set.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue