mirror of
https://github.com/photonstorm/phaser
synced 2025-01-11 20:58:56 +00:00
36 lines
928 B
JavaScript
36 lines
928 B
JavaScript
/**
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
* @copyright 2013-2023 Photon Storm Ltd.
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
|
*/
|
|
|
|
/**
|
|
* Used internally by the KeyCombo class.
|
|
* Return `true` if it reached the end of the combo, `false` if not.
|
|
*
|
|
* @function Phaser.Input.Keyboard.AdvanceKeyCombo
|
|
* @private
|
|
* @since 3.0.0
|
|
*
|
|
* @param {KeyboardEvent} event - The native Keyboard Event.
|
|
* @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to advance.
|
|
*
|
|
* @return {boolean} `true` if it reached the end of the combo, `false` if not.
|
|
*/
|
|
var AdvanceKeyCombo = function (event, combo)
|
|
{
|
|
combo.timeLastMatched = event.timeStamp;
|
|
combo.index++;
|
|
|
|
if (combo.index === combo.size)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
combo.current = combo.keyCodes[combo.index];
|
|
return false;
|
|
}
|
|
};
|
|
|
|
module.exports = AdvanceKeyCombo;
|