softer failure sound for ui/learn

pull/3338/merge
Thibault Duplessis 2017-07-24 14:12:47 +02:00
parent 0adb337a9d
commit fa5428f137
8 changed files with 5 additions and 21 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -39,10 +39,6 @@ module.exports = function(blueprint, opts) {
// cheat
Mousetrap.bind(['shift+enter'], complete);
var failSoundOnce = function() {
sound.once('failure', opts.stage.key + '/' + blueprint.id);
};
var assertData = function() {
return {
scenario: scenario,
@ -53,7 +49,7 @@ module.exports = function(blueprint, opts) {
var detectFailure = function() {
var failed = blueprint.failure && blueprint.failure(assertData());
if (failed) failSoundOnce();
if (failed) sound.failure();
return failed;
};
@ -70,7 +66,7 @@ module.exports = function(blueprint, opts) {
vm.failed = true;
ground.stop();
ground.showCapture(move);
failSoundOnce();
sound.failure();
return true;
};
@ -81,7 +77,7 @@ module.exports = function(blueprint, opts) {
else { // moving into check
vm.failed = true;
ground.showCheckmate(chess);
failSoundOnce();
sound.failure();
return m.redraw();
}
var took = false,

View File

@ -15,8 +15,7 @@ var make = function(file, volume) {
};
};
var sounds = {
module.exports = {
move: make('standard/Move'),
take: make('sfx/Tournament3rd', 0.4),
levelStart: make('other/ping'),
@ -24,16 +23,5 @@ var sounds = {
stageStart: make('other/guitar'),
// stageEnd: make('sfx/Tournament1st'),
stageEnd: make('other/gewonnen'),
failure: make('other/failure')
failure: make('other/no-go')
};
var onces = [];
sounds.once = function(sound, id) {
var key = id + '/' + sound;
if (onces.indexOf(key) === -1) {
sounds[sound]();
onces.push(key);
}
};
module.exports = sounds;