Updated and simplified logic for performing locked actions

This commit is contained in:
Pavle Goloskokovic 2018-01-17 19:07:52 +01:00
parent aacd7a972d
commit 88d26607ec

View file

@ -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;
} }
}); });
}); });