mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
The Spine Plugin destroy
method will now no longer remove the Game Objects from the Game Object Factory, or dispose of the Scene Renderer. This means when a Scene is destroyed, it will keep the Game Objects in the factory for other Scene's to use. Fix #5279
`SpinePlugin.gameDestroy` is a new method that is called if the Game instance emits a `destroy` event. It removes the Spine Game Objects from the factory and disposes of the Spine scene renderer.
This commit is contained in:
parent
8f48d39934
commit
1fa91daa39
1 changed files with 27 additions and 10 deletions
|
@ -411,6 +411,8 @@ var SpinePlugin = new Class({
|
|||
|
||||
eventEmitter.once('shutdown', this.shutdown, this);
|
||||
eventEmitter.once('destroy', this.destroy, this);
|
||||
|
||||
this.game.events.once('destroy', this.gameDestroy, this);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1095,15 +1097,6 @@ var SpinePlugin = new Class({
|
|||
{
|
||||
this.shutdown();
|
||||
|
||||
if (this.sceneRenderer)
|
||||
{
|
||||
this.sceneRenderer.dispose();
|
||||
}
|
||||
|
||||
this.pluginManager.removeGameObject('spine', true, true);
|
||||
this.pluginManager.removeGameObject('spineContainer', true, true);
|
||||
|
||||
this.pluginManager = null;
|
||||
this.game = null;
|
||||
this.scene = null;
|
||||
this.systems = null;
|
||||
|
@ -1112,9 +1105,33 @@ var SpinePlugin = new Class({
|
|||
this.spineTextures = null;
|
||||
this.json = null;
|
||||
this.textures = null;
|
||||
this.sceneRenderer = null;
|
||||
this.skeletonRenderer = null;
|
||||
this.gl = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* The Game that owns this plugin is being destroyed.
|
||||
*
|
||||
* Dispose of the Scene Renderer and remove the Game Objects.
|
||||
*
|
||||
* @method SpinePlugin#gameDestroy
|
||||
* @private
|
||||
* @since 3.50.0
|
||||
*/
|
||||
gameDestroy: function ()
|
||||
{
|
||||
this.destroy();
|
||||
|
||||
if (this.sceneRenderer)
|
||||
{
|
||||
this.sceneRenderer.dispose();
|
||||
}
|
||||
|
||||
this.sceneRenderer = null;
|
||||
this.pluginManager = null;
|
||||
|
||||
this.pluginManager.removeGameObject('spine', true, true);
|
||||
this.pluginManager.removeGameObject('spineContainer', true, true);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue