crazyhouse piece drop sound

This commit is contained in:
Thibault Duplessis 2016-01-18 16:00:13 +07:00
parent 9e0d694fc4
commit 461bd661fe
2 changed files with 8 additions and 3 deletions

View file

@ -73,7 +73,11 @@ module.exports = function(opts) {
} else sound.move();
}.bind(this);
this.chessground = ground.make(this.data, this.vm.ply, onUserMove, onUserNewPiece, onMove);
var onNewPiece = function(piece, pos) {
sound.move();
}.bind(this);
this.chessground = ground.make(this.data, this.vm.ply, onUserMove, onUserNewPiece, onMove, onNewPiece);
this.replaying = function() {
return this.vm.ply !== round.lastPly(this.data);

View file

@ -60,14 +60,15 @@ function makeConfig(data, ply, flip) {
};
}
function make(data, ply, userMove, userNewPiece, onMove) {
function make(data, ply, userMove, userNewPiece, onMove, onNewPiece) {
var config = makeConfig(data, ply);
config.movable.events = {
after: userMove,
afterNewPiece: userNewPiece
};
config.events = {
move: onMove
move: onMove,
dropNewPiece: onNewPiece
};
config.viewOnly = data.player.spectator;
return new chessground.controller(config);