mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 07:31:11 +00:00
Added abillity to count children with matching properties
This commit is contained in:
parent
ca7acdc3bd
commit
e0adac3ced
1 changed files with 17 additions and 0 deletions
|
@ -223,6 +223,23 @@ var List = new Class({
|
||||||
return output;
|
return output;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
count: function (property, value)
|
||||||
|
{
|
||||||
|
var total = 0;
|
||||||
|
|
||||||
|
for (var i = 0; i < this.list.length; i++)
|
||||||
|
{
|
||||||
|
var child = this.list[i];
|
||||||
|
|
||||||
|
if (child[property] === value)
|
||||||
|
{
|
||||||
|
total++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
},
|
||||||
|
|
||||||
swap: function (child1, child2)
|
swap: function (child1, child2)
|
||||||
{
|
{
|
||||||
if (child1 === child2)
|
if (child1 === child2)
|
||||||
|
|
Loading…
Reference in a new issue