round sounds
This commit is contained in:
parent
c327be6d1e
commit
1ecf483812
|
@ -581,12 +581,12 @@ var storage = {
|
|||
var audio = {
|
||||
dong: new Audio(baseUrl + 'dong.ogg'),
|
||||
moveW: new Audio(baseUrl + 'wood_light_hit_1.' + ext),
|
||||
moveB: new Audio(baseUrl + 'wood_light_hit_3.' + ext),
|
||||
moveB: new Audio(baseUrl + 'wood_light_hit_1.' + ext),
|
||||
take: new Audio(baseUrl + 'wood_capture_hit_and_roll.' + ext)
|
||||
};
|
||||
var volumes = {
|
||||
dong: 0.6,
|
||||
moveW: 0.7,
|
||||
moveW: 1,
|
||||
moveB: 1,
|
||||
take: 0.1
|
||||
};
|
||||
|
@ -695,6 +695,7 @@ var storage = {
|
|||
messages: cfg.data.chat
|
||||
});
|
||||
var $watchers = $('#site_header div.watchers').watchers();
|
||||
if (cfg.tournament) $('body').data('tournament-id', cfg.tournament.id);
|
||||
lichess.socket = new lichess.StrongSocket(
|
||||
cfg.data.url.socket,
|
||||
cfg.data.player.version,
|
||||
|
@ -714,6 +715,7 @@ var storage = {
|
|||
}
|
||||
});
|
||||
var round = LichessRound(this.element[0], cfg.data, cfg.routes, cfg.i18n, lichess.socket.send.bind(lichess.socket));
|
||||
startTournamentClock();
|
||||
},
|
||||
_old_init: function() {
|
||||
var self = this;
|
||||
|
|
|
@ -11,6 +11,7 @@ var xhr = require('./xhr');
|
|||
var title = require('./title');
|
||||
var promotion = require('./promotion');
|
||||
var hold = require('./hold');
|
||||
var init = require('./init');
|
||||
var clockCtrl = require('./clock/ctrl');
|
||||
|
||||
module.exports = function(cfg, router, i18n, socketSend) {
|
||||
|
@ -36,6 +37,7 @@ module.exports = function(cfg, router, i18n, socketSend) {
|
|||
this.userMove = function(orig, dest, meta) {
|
||||
hold.register(meta.holdTime);
|
||||
if (!promotion.start(this, orig, dest, meta.premove)) this.sendMove(orig, dest);
|
||||
$.sound.move(this.data.player.color == 'white');
|
||||
}.bind(this);
|
||||
|
||||
this.chessground = ground.make(this.data, cfg.game.fen, this.userMove);
|
||||
|
@ -72,6 +74,5 @@ module.exports = function(cfg, router, i18n, socketSend) {
|
|||
return str;
|
||||
};
|
||||
|
||||
title.init(this);
|
||||
this.setTitle();
|
||||
init(this);
|
||||
};
|
||||
|
|
10
ui/round/src/init.js
Normal file
10
ui/round/src/init.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
var title = require('./title');
|
||||
var round = require('./round');
|
||||
|
||||
module.exports = function(ctrl) {
|
||||
|
||||
title.init(ctrl);
|
||||
ctrl.setTitle();
|
||||
|
||||
if (round.playable(ctrl.data) && ctrl.data.game.turns < 2) $.sound.dong();
|
||||
};
|
|
@ -30,6 +30,7 @@ module.exports = function(send, ctrl) {
|
|||
ctrl.chessground.apiMove(o.from, o.to);
|
||||
if (ctrl.data.game.threefold) ctrl.data.game.threefold = false;
|
||||
m.endComputation();
|
||||
$.sound.move(o.color == 'white');
|
||||
},
|
||||
premove: function() {
|
||||
ctrl.chessground.playPremove();
|
||||
|
@ -91,6 +92,7 @@ module.exports = function(send, ctrl) {
|
|||
end: function() {
|
||||
ground.end(ctrl.chessground);
|
||||
xhr.reload(ctrl.data).then(ctrl.reload);
|
||||
$.sound.dong();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue