Setting locked lag only if there are locked audio tags

This commit is contained in:
Pavle Goloskokovic 2018-04-21 20:09:18 +02:00
parent eec19e146a
commit 116e62fafe

View file

@ -154,15 +154,30 @@ var HTML5AudioSoundManager = new Class({
*/ */
unlock: function () unlock: function ()
{ {
this.locked = 'ontouchstart' in window; this.locked = false;
var _this = this;
this.game.cache.audio.entries.each(function (key, tags)
{
for (var i = 0; i < tags.length; i++)
{
if (tags[i].dataset.locked === 'true')
{
_this.locked = true;
return false;
}
}
return true;
});
if(!this.locked) if(!this.locked)
{ {
return; return;
} }
var _this = this;
var moved = false; var moved = false;
var detectMove = function () var detectMove = function ()