Fix pausing during autoplay

This commit is contained in:
LoveEevee 2018-08-28 03:44:17 +03:00
parent 2f717614fb
commit fcc3235bec
2 changed files with 20 additions and 3 deletions

View File

@ -12,17 +12,30 @@ function Keyboard(controller){
// Disable back navigation when pressing backspace
e.preventDefault();
if(!controller.autoPlay()){
if(_this.buttonEnabled(e.which)){
_this.setKey(e.which, true);
}
});
$(document).keyup(function(e){
if(!controller.autoPlay()){
if(_this.buttonEnabled(e.which)){
_this.setKey(e.which, false);
}
});
this.buttonEnabled = function(keyCode){
if(controller.autoPlay()){
switch(keyCode){
case 86:
case 66:
case 67:
case 78:
return false
}
}
return true
}
this.checkGameKeys = function(){
if(_keys[86] && !_this.isWaitingForKeyup(86, "sound")){
@ -58,7 +71,7 @@ function Keyboard(controller){
controller.songSelection();
}
if(_keys[81] && !_this.isWaitingForKeyup(81, "menu")){
// P, pause the game
// Q, pause the game
_this.waitForKeyup(81, "menu");
controller.togglePauseMenu();
}

View File

@ -30,6 +30,10 @@ function soundSystem(controller){
}
this.pauseSound = function(){
_sounds["main-music"].pause();
}
this.fadeOutMusic = function(){
if(_sounds["main-music"].volume.toFixed(1)!=0.0){