mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 08:11:54 +08:00
add button to turn volume on and off
This commit is contained in:
+24
-2
@@ -133,6 +133,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
$('<span>')
|
||||
.addClass('volume menuBtn')
|
||||
.text(_('sound off.'))
|
||||
.click(Engine.toggleVolume)
|
||||
.appendTo(menu);
|
||||
|
||||
$('<span>')
|
||||
.addClass('appStore menuBtn')
|
||||
.text(_('get the app.'))
|
||||
@@ -215,12 +221,16 @@
|
||||
Ship.init();
|
||||
}
|
||||
|
||||
if(!$SM.get('config.soundOn')){
|
||||
Engine.toggleVolume();
|
||||
}
|
||||
|
||||
if($SM.get('config.lightsOff', true)){
|
||||
Engine.turnLightsOff();
|
||||
Engine.turnLightsOff();
|
||||
}
|
||||
|
||||
if($SM.get('config.hyperMode', true)){
|
||||
Engine.triggerHyperMode();
|
||||
Engine.triggerHyperMode();
|
||||
}
|
||||
|
||||
Engine.saveLanguage();
|
||||
@@ -782,6 +792,18 @@
|
||||
}
|
||||
},
|
||||
|
||||
toggleVolume: function() {
|
||||
if ($SM.get('config.soundOn')) {
|
||||
$('.volume').text(_('sound on.'));
|
||||
$SM.set('config.soundOn', false);
|
||||
AudioEngine.mute();
|
||||
} else {
|
||||
$('.volume').text(_('sound off.'));
|
||||
$SM.set('config.soundOn', true);
|
||||
AudioEngine.setVolume(1.0);
|
||||
}
|
||||
},
|
||||
|
||||
setInterval: function(callback, interval, skipDouble){
|
||||
if( Engine.options.doubleTime && !skipDouble ){
|
||||
Engine.log('Double time, cutting interval in half');
|
||||
|
||||
Reference in New Issue
Block a user