mirror of
https://github.com/photonstorm/phaser
synced 2024-11-30 00:21:04 +00:00
Added internalCreateCallback
and internalRemoveCallback
to a Group
This commit is contained in:
parent
847abb0ef2
commit
08c4ab0e4c
1 changed files with 32 additions and 0 deletions
|
@ -214,6 +214,28 @@ var Group = new Class({
|
||||||
*/
|
*/
|
||||||
this.createMultipleCallback = GetFastValue(config, 'createMultipleCallback', null);
|
this.createMultipleCallback = GetFastValue(config, 'createMultipleCallback', null);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function to be called when adding or creating group members.
|
||||||
|
* For internal use only by a Group, or any class that extends it.
|
||||||
|
*
|
||||||
|
* @name Phaser.GameObjects.Group#internalCreateCallback
|
||||||
|
* @type {?Phaser.Types.GameObjects.Group.GroupCallback}
|
||||||
|
* @private
|
||||||
|
* @since 3.22.0
|
||||||
|
*/
|
||||||
|
this.internalCreateCallback = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function to be called when removing group members.
|
||||||
|
* For internal use only by a Group, or any class that extends it.
|
||||||
|
*
|
||||||
|
* @name Phaser.GameObjects.Group#internalRemoveCallback
|
||||||
|
* @type {?Phaser.Types.GameObjects.Group.GroupCallback}
|
||||||
|
* @private
|
||||||
|
* @since 3.22.0
|
||||||
|
*/
|
||||||
|
this.internalRemoveCallback = null;
|
||||||
|
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
this.createMultiple(config);
|
this.createMultiple(config);
|
||||||
|
@ -512,6 +534,11 @@ var Group = new Class({
|
||||||
|
|
||||||
this.children.set(child);
|
this.children.set(child);
|
||||||
|
|
||||||
|
if (this.internalCreateCallback)
|
||||||
|
{
|
||||||
|
this.internalCreateCallback.call(this, child);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.createCallback)
|
if (this.createCallback)
|
||||||
{
|
{
|
||||||
this.createCallback.call(this, child);
|
this.createCallback.call(this, child);
|
||||||
|
@ -586,6 +613,11 @@ var Group = new Class({
|
||||||
|
|
||||||
this.children.delete(child);
|
this.children.delete(child);
|
||||||
|
|
||||||
|
if (this.internalRemoveCallback)
|
||||||
|
{
|
||||||
|
this.internalRemoveCallback.call(this, child);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.removeCallback)
|
if (this.removeCallback)
|
||||||
{
|
{
|
||||||
this.removeCallback.call(this, child);
|
this.removeCallback.call(this, child);
|
||||||
|
|
Loading…
Reference in a new issue