X-Git-Url: https://git.auder.net/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=84088c05c60ceda50c7cd269a325cd53c6428d91;hb=936dc463c969f648ae0bc81074ff3272c7c99697;hp=8009edd70f0b429fd6451f2b3adfef32924cccb8;hpb=81da2786f2f497b4416e0488c34a48fb794c28df;p=vchess.git
diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js
index 8009edd7..84088c05 100644
--- a/public/javascripts/components/game.js
+++ b/public/javascripts/components/game.js
@@ -45,6 +45,8 @@ Vue.component('my-game', {
{{ endgameMessage }}
+
+
//TODO: connection + turn indicators en haut à droite (superposé au menu)
@@ -82,7 +84,7 @@ Vue.component('my-game', {
},
created: function() {
const url = socketUrl;
- this.conn = new WebSocket(url + "/?sid=" + this.myid + "&page=" + variant);
+ this.conn = new WebSocket(url + "/?sid=" + this.myid + "&page=" + variant._id);
// const socketOpenListener = () => {
// };
@@ -95,7 +97,7 @@ Vue.component('my-game', {
switch (data.code)
{
case "newmove": //..he played!
- this.play(data.move, (variant!="Dark" ? "animate" : null));
+ this.play(data.move, (variant.name!="Dark" ? "animate" : null));
break;
case "pong": //received if we sent a ping (game still alive on our side)
if (this.gameId != data.gameId)
@@ -161,7 +163,7 @@ Vue.component('my-game', {
};
const socketCloseListener = () => {
- this.conn = new WebSocket(url + "/?sid=" + this.myid + "&page=" + variant);
+ this.conn = new WebSocket(url + "/?sid=" + this.myid + "&page=" + variant._id);
//this.conn.addEventListener('open', socketOpenListener);
this.conn.addEventListener('message', socketMessageListener);
this.conn.addEventListener('close', socketCloseListener);
@@ -187,7 +189,7 @@ Vue.component('my-game', {
// Computer moves web worker logic: (TODO: also for observers in HH games)
- this.compWorker.postMessage(["scripts",variant]);
+ this.compWorker.postMessage(["scripts",variant.name]);
const self = this;
this.compWorker.onmessage = function(e) {
let compMove = e.data;
@@ -201,7 +203,7 @@ Vue.component('my-game', {
// before they appear on page:
const delay = Math.max(500-(Date.now()-self.timeStart), 0);
setTimeout(() => {
- const animate = (variant!="Dark" ? "animate" : null);
+ const animate = (variant.name!="Dark" ? "animate" : null);
if (self.mode == "computer") //warning: mode could have changed!
self.play(compMove[0], animate);
if (compMove.length == 2)