Updated docs and Creator param

This commit is contained in:
Richard Davey 2020-08-26 00:00:00 +01:00
parent a9c32d4efa
commit 413a148a31
2 changed files with 34 additions and 8 deletions

View file

@ -76,10 +76,15 @@ var NOOP = require('../../../src/utils/NOOP');
* this.load.spine('stretchyman', 'stretchyman-pro.json', [ 'stretchyman-pma.atlas' ], true);
* ```
*
* It also installs a Game Object Factory method, allowing you to create Spine Game Objects:
* It also installs two Game Object Factory methods, allowing you to create Spine Game Objects
* and Spine Containers:
*
* ```javascript
* this.add.spine(512, 650, 'stretchyman')
* const man = this.add.spine(512, 650, 'stretchyman');
*
* const container = this.add.spineContainer();
*
* container.add(man);
* ```
*
* The first argument is the key which you used when importing the Spine data. There are lots of
@ -379,7 +384,7 @@ var SpinePlugin = new Class({
pluginManager.registerFileType('spine', this.spineFileCallback, scene);
pluginManager.registerGameObject('spine', add, make);
pluginManager.registerGameObject('spinecontainer', addContainer, makeContainer);
pluginManager.registerGameObject('spineContainer', addContainer, makeContainer);
},
/**
@ -1096,6 +1101,7 @@ var SpinePlugin = new Class({
}
this.pluginManager.removeGameObject('spine', true, true);
this.pluginManager.removeGameObject('spineContainer', true, true);
this.pluginManager = null;
this.game = null;
@ -1114,6 +1120,7 @@ var SpinePlugin = new Class({
});
SpinePlugin.SpineGameObject = SpineGameObject;
SpinePlugin.SpineContainer = SpineContainer;
/**
* Creates a new Spine Game Object and adds it to the Scene.

View file

@ -13,8 +13,8 @@ var SpineContainerRender = require('./SpineContainerRender');
* A Spine Container is a special kind of Container created specifically for Spine Game Objects.
*
* You have all of the same features of a standard Container, but the rendering functions are optimized specifically
* for Spine Game Objects. You cannot mix and match Spine Game Objects with regular Game Objects inside of this
* type of Container, however.
* for Spine Game Objects. You must only add ever Spine Game Objects to this type of Container. Although Phaser will
* not prevent you from adding other types, they will not render and are likely to throw runtime errors.
*
* To create one in a Scene, use the factory methods:
*
@ -28,7 +28,7 @@ var SpineContainerRender = require('./SpineContainerRender');
* this.make.spinecontainer();
* ```
*
* See the Container documentation for further details.
* See the Container documentation for further details about what Containers can do.
*
* @class SpineContainer
* @extends Phaser.GameObjects.Container
@ -61,11 +61,30 @@ var SpineContainer = new Class({
/**
* A reference to the Spine Plugin.
*
* @name SpineGameObject#plugin
* @name SpineContainer#plugin
* @type {SpinePlugin}
* @since 3.19.0
* @since 3.50.0
*/
this.plugin = plugin;
},
/**
* Internal destroy handler, called as part of the destroy process.
*
* @method SpineContainer#preDestroy
* @protected
* @since 3.50.0
*/
preDestroy: function ()
{
this.removeAll(!!this.exclusive);
this.localTransform.destroy();
this.tempTransformMatrix.destroy();
this.list = [];
this._displayList = null;
this.plugin = null;
}
});