mirror of
https://github.com/wassname/phaser.git
synced 2026-07-02 17:00:42 +08:00
New Group.destroy example and patched the desyrel font xml.
This commit is contained in:
+42
-4
@@ -1338,11 +1338,31 @@ Phaser.Group.prototype = {
|
||||
* Destroys this Group. Removes all children, then removes the container from the display list and nulls references.
|
||||
*
|
||||
* @method Phaser.Group#destroy
|
||||
* @param {boolean} [destroyChildren=false] - Should every child of this Group have its destroy method called?
|
||||
*/
|
||||
destroy: function () {
|
||||
destroy: function (destroyChildren) {
|
||||
|
||||
this.removeAll();
|
||||
if (typeof destroyChildren === 'undefined') { destroyChildren = false; }
|
||||
|
||||
if (destroyChildren)
|
||||
{
|
||||
if (this._container.children.length > 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (this._container.children[0].group)
|
||||
{
|
||||
this._container.children[0].destroy();
|
||||
}
|
||||
}
|
||||
while (this._container.children.length > 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeAll();
|
||||
}
|
||||
|
||||
this._container.parent.removeChild(this._container);
|
||||
|
||||
this._container = null;
|
||||
@@ -1505,7 +1525,16 @@ Phaser.Group.prototype.constructor = Phaser.Group;
|
||||
Object.defineProperty(Phaser.Group.prototype, "total", {
|
||||
|
||||
get: function () {
|
||||
return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL);
|
||||
|
||||
if (this._container)
|
||||
{
|
||||
return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1518,7 +1547,16 @@ Object.defineProperty(Phaser.Group.prototype, "total", {
|
||||
Object.defineProperty(Phaser.Group.prototype, "length", {
|
||||
|
||||
get: function () {
|
||||
return this._container.children.length;
|
||||
|
||||
if (this._container)
|
||||
{
|
||||
return this._container.children.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -120,11 +120,6 @@ Phaser.BitmapText = function (game, x, y, text, style) {
|
||||
this._cache.x = this.x;
|
||||
this._cache.y = this.y;
|
||||
|
||||
/**
|
||||
* @property {boolean} renderable - A renderable object will be rendered to the context each frame.
|
||||
*/
|
||||
this.renderable = true;
|
||||
|
||||
};
|
||||
|
||||
Phaser.BitmapText.prototype = Object.create(PIXI.BitmapText.prototype);
|
||||
@@ -153,8 +148,8 @@ Phaser.BitmapText.prototype.update = function() {
|
||||
this._cache.dirty = true;
|
||||
}
|
||||
|
||||
this.pivot.x = this.anchor.x*this.width;
|
||||
this.pivot.y = this.anchor.y*this.height;
|
||||
this.pivot.x = this.anchor.x * this.width;
|
||||
this.pivot.y = this.anchor.y * this.height;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user