mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 00:53:42 +00:00
Updated and simplified logic for performing locked actions
This commit is contained in:
parent
aacd7a972d
commit
88d26607ec
1 changed files with 6 additions and 20 deletions
|
@ -106,26 +106,12 @@ var HTML5AudioSoundManager = new Class({
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
this.once('unlocked', function () {
|
this.once('unlocked', function () {
|
||||||
var allSoundsTouchLockedActionQueue = [];
|
_this.lockedActionsQueue.forEach(function (lockedAction) {
|
||||||
_this.forEachActiveSound(function (sound) {
|
if (lockedAction.sound[lockedAction.name].apply) {
|
||||||
sound.touchLockedActionQueue.forEach(function (touchLockedAction) {
|
lockedAction.sound[lockedAction.name].apply(lockedAction.sound, lockedAction.value || []);
|
||||||
allSoundsTouchLockedActionQueue.push(touchLockedAction);
|
}
|
||||||
});
|
else {
|
||||||
sound.touchLockedActionQueue.length = 0;
|
lockedAction.sound[lockedAction.name] = lockedAction.value;
|
||||||
sound.touchLockedActionQueue = null;
|
|
||||||
// TODO set correct duration value
|
|
||||||
});
|
|
||||||
allSoundsTouchLockedActionQueue.sort(function (tla1, tla2) {
|
|
||||||
return tla1.time - tla2.time;
|
|
||||||
});
|
|
||||||
allSoundsTouchLockedActionQueue.forEach(function (touchLockedAction) {
|
|
||||||
switch (touchLockedAction.type) {
|
|
||||||
case 'method':
|
|
||||||
touchLockedAction.sound[touchLockedAction.name].apply(touchLockedAction.sound, touchLockedAction.value || []);
|
|
||||||
break;
|
|
||||||
case 'property':
|
|
||||||
touchLockedAction.sound[touchLockedAction.name] = touchLockedAction.value;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue