mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
ArraySet.getByKey gets an item from the set based on the property strictly equaling the value given.
This commit is contained in:
parent
8d71e8a32c
commit
5fd066c610
2 changed files with 26 additions and 0 deletions
|
@ -157,6 +157,7 @@ We've also removed functions and properties from Pixi classes that Phaser doesn'
|
||||||
* Tween.repeat has a new parameter `repeatDelay` which allows you to set the delay (in ms) before a tween will repeat itself.
|
* Tween.repeat has a new parameter `repeatDelay` which allows you to set the delay (in ms) before a tween will repeat itself.
|
||||||
* Tween.yoyo has a new parameter `yoyoDelay` which allows you to set the delay (in ms) before a tween will start a yoyo.
|
* Tween.yoyo has a new parameter `yoyoDelay` which allows you to set the delay (in ms) before a tween will start a yoyo.
|
||||||
* Tween.interpolation has a new parameter `context` which allows you to define the context in which the interpolation function will run.
|
* Tween.interpolation has a new parameter `context` which allows you to define the context in which the interpolation function will run.
|
||||||
|
* ArraySet.getByKey gets an item from the set based on the property strictly equaling the value given.
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,31 @@ Phaser.ArraySet.prototype = {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an item from the set based on the property strictly equaling the value given.
|
||||||
|
* Returns null if not found.
|
||||||
|
*
|
||||||
|
* @method Phaser.ArraySet#getByKey
|
||||||
|
* @param {string} property - The property to check against the value.
|
||||||
|
* @param {any} value - The value to check if the property strictly equals.
|
||||||
|
* @return {any} The item that was found, or null if nothing matched.
|
||||||
|
*/
|
||||||
|
getByKey: function (property, value) {
|
||||||
|
|
||||||
|
var i = this.list.length;
|
||||||
|
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
if (this.list[i][property] === value)
|
||||||
|
{
|
||||||
|
return this.list[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for the item within this list.
|
* Checks for the item within this list.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue