From 90e461b587c824e0fb3e50be42757bc2e62a8f7f Mon Sep 17 00:00:00 2001 From: Bui Date: Mon, 6 Aug 2018 11:13:01 +0100 Subject: [PATCH] more audio updates --- src/js/assets.js | 10 +++++++++- src/js/game.js | 2 ++ src/js/loadsong.js | 3 +++ src/js/scoresheet.js | 10 +++++++++- src/js/songselect.js | 3 ++- src/js/titlescreen.js | 2 ++ 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/js/assets.js b/src/js/assets.js index 2228027..5dd98b5 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -37,7 +37,15 @@ var assets = { 'combo-500.wav', 'combo-600.wav', 'combo-700.wav', - 'song-select.wav' + 'song-select.wav', + 'title.ogg', + 'pause.wav', + 'cancel.wav', + 'results.wav', + + + 'bgm_songsel.mp3', + 'bgm_results.ogg' ), songs: new Array(), diff --git a/src/js/game.js b/src/js/game.js index 98f5c27..9406664 100644 --- a/src/js/game.js +++ b/src/js/game.js @@ -249,12 +249,14 @@ function Game(controller, selectedSong, songData){ this.togglePause = function(){ if(!_paused){ + assets.sounds["pause"].play(); _paused=true; _latestDate = new Date(); _this.toggleMainMusic(); } else{ + assets.sounds["cancel"].play(); _paused=false; var currentDate = new Date(); _ellapsedTimeSincePause = _ellapsedTimeSincePause + Math.abs(currentDate.getTime() - _latestDate.getTime()); diff --git a/src/js/loadsong.js b/src/js/loadsong.js index a18f24c..e46dc30 100644 --- a/src/js/loadsong.js +++ b/src/js/loadsong.js @@ -10,6 +10,9 @@ function loadSong(selectedSong){ this.run = function(){ + assets.sounds["bgm_songsel"].pause(); + assets.sounds["bgm_songsel"].currentTime = 0; + assets.sounds["start"].play(); $("#assets").append(""); diff --git a/src/js/scoresheet.js b/src/js/scoresheet.js index 9f72f6b..c2ebcda 100644 --- a/src/js/scoresheet.js +++ b/src/js/scoresheet.js @@ -71,15 +71,23 @@ function Scoresheet(controller, score){ } this.run = function(){ - + assets.sounds["results"].play(); + + assets.sounds["bgm_results"].volume = 1; + assets.sounds["bgm_results"].play(); + _this.positionning(); _this.setResults(); $("#song-select").click(function(){ + assets.sounds["bgm_results"].pause(); + assets.sounds["bgm_songsel"].currentTime = 0; controller.songSelection(); }); $("#replay").click(function(){ + assets.sounds["bgm_results"].pause(); + assets.sounds["bgm_songsel"].currentTime = 0; controller.restartSong(); }); diff --git a/src/js/songselect.js b/src/js/songselect.js index 7e0d70a..36d1475 100644 --- a/src/js/songselect.js +++ b/src/js/songselect.js @@ -50,7 +50,8 @@ function SongSelect(){ } this.createCode = function(){ - + + assets.sounds["bgm_songsel"].play(); assets.sounds["song-select"].play(); for(var i=0; i