mirror of
https://github.com/wassname/phaser.git
synced 2026-07-07 00:06:37 +08:00
Group.length now returns the number of children in the Group regardless of their exists/alive state, or 0 if the Group is has no children.
This commit is contained in:
+7
-9
@@ -1047,7 +1047,7 @@ Phaser.Group.prototype = {
|
||||
*/
|
||||
iterate: function (key, value, returnType, callback, callbackContext, args) {
|
||||
|
||||
if (returnType == Phaser.Group.RETURN_TOTAL && this._container.children.length === 0)
|
||||
if (returnType === Phaser.Group.RETURN_TOTAL && this._container.children.length === 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@ Phaser.Group.prototype = {
|
||||
callback.apply(callbackContext, args);
|
||||
}
|
||||
|
||||
if (returnType == Phaser.Group.RETURN_CHILD)
|
||||
if (returnType === Phaser.Group.RETURN_CHILD)
|
||||
{
|
||||
return currentNode;
|
||||
}
|
||||
@@ -1086,11 +1086,11 @@ Phaser.Group.prototype = {
|
||||
while (currentNode != this._container.last._iNext);
|
||||
}
|
||||
|
||||
if (returnType == Phaser.Group.RETURN_TOTAL)
|
||||
if (returnType === Phaser.Group.RETURN_TOTAL)
|
||||
{
|
||||
return total;
|
||||
}
|
||||
else if (returnType == Phaser.Group.RETURN_CHILD)
|
||||
else if (returnType === Phaser.Group.RETURN_CHILD)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -1460,28 +1460,26 @@ Phaser.Group.prototype = {
|
||||
|
||||
/**
|
||||
* @name Phaser.Group#total
|
||||
* @property {number} total - The total number of children in this Group, regardless of their alive state.
|
||||
* @property {number} total - The total number of children in this Group who have a state of exists = true.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Group.prototype, "total", {
|
||||
|
||||
get: function () {
|
||||
return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL);
|
||||
// return this._container.children.length;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* @name Phaser.Group#length
|
||||
* @property {number} length - The number of children in this Group.
|
||||
* @property {number} length - The total number of children in this Group, regardless of their exists/alive status.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Group.prototype, "length", {
|
||||
|
||||
get: function () {
|
||||
return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL);
|
||||
// return this._container.children.length;
|
||||
return this._container.children.length;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -374,9 +374,6 @@ PIXI.DisplayObject.prototype.addFilter = function(data)
|
||||
//this.filter = true;
|
||||
// data[0].target = this;
|
||||
|
||||
console.log('addFilter');
|
||||
console.log(data);
|
||||
|
||||
// insert a filter block..
|
||||
// TODO Onject pool thease bad boys..
|
||||
var start = new PIXI.FilterBlock();
|
||||
@@ -395,8 +392,6 @@ console.log(data);
|
||||
|
||||
start.target = this;
|
||||
|
||||
console.log('start', start);
|
||||
|
||||
/*
|
||||
* insert start
|
||||
*/
|
||||
@@ -484,13 +479,7 @@ PIXI.DisplayObject.prototype.removeFilter = function(data)
|
||||
// console.log("YUOIO")
|
||||
// modify the list..
|
||||
|
||||
console.log('DisplayObject removeFilter');
|
||||
console.log(data);
|
||||
|
||||
var startBlock = data.start;
|
||||
|
||||
console.log('start', startBlock);
|
||||
|
||||
var nextObject = startBlock._iNext;
|
||||
var previousObject = startBlock._iPrev;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user