mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 08:11:54 +08:00
fix sound turning on/off randomly on first user click due to toggleVolume call
This commit is contained in:
+9
-3
@@ -240,17 +240,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!AudioEngine.isAudioContextRunning()){
|
if(!AudioEngine.isAudioContextRunning()){
|
||||||
Engine.toggleVolume();
|
|
||||||
document.addEventListener('click', Engine.resumeAudioContext);
|
document.addEventListener('click', Engine.resumeAudioContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine.saveLanguage();
|
Engine.saveLanguage();
|
||||||
Engine.travelTo(Room);
|
Engine.travelTo(Room);
|
||||||
|
|
||||||
},
|
},
|
||||||
resumeAudioContext: function () {
|
resumeAudioContext: function () {
|
||||||
AudioEngine.tryResumingAudioContext();
|
AudioEngine.tryResumingAudioContext();
|
||||||
Engine.toggleVolume();
|
|
||||||
|
// turn on music!
|
||||||
|
if (AudioEngine._audioContext.state !== 'suspended') {
|
||||||
|
$('.volume').text(_('sound off.'));
|
||||||
|
$SM.set('config.soundOn', true);
|
||||||
|
AudioEngine.setMasterVolume(1.0);
|
||||||
|
}
|
||||||
|
|
||||||
document.removeEventListener('click', Engine.resumeAudioContext);
|
document.removeEventListener('click', Engine.resumeAudioContext);
|
||||||
},
|
},
|
||||||
browserValid: function() {
|
browserValid: function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user