<!-- TODO: component Game, + handle players + observers connect/disconnect
event = "gameconnect" ...etc
connect/disconnect with sid+name (ID not required); name slightly redundant but easier
<!-- TODO: component Game, + handle players + observers connect/disconnect
event = "gameconnect" ...etc
connect/disconnect with sid+name (ID not required); name slightly redundant but easier
quand on arrive dans la partie, on poll les sids pour savoir qui est en ligne (ping)
(éventuel échange lastate avec les connectés, pong ...etc)
ensuite quand qqun se deco il suffit d'écouter "disconnect"
pareil quand quelqu'un reco.
(c'est assez rudimentaire et écoute trop de messages, mais dans un premier temps...)
// TODO: [in game] send move + elapsed time (in milliseconds); in case of "lastate" message too
quand on arrive dans la partie, on poll les sids pour savoir qui est en ligne (ping)
(éventuel échange lastate avec les connectés, pong ...etc)
ensuite quand qqun se deco il suffit d'écouter "disconnect"
pareil quand quelqu'un reco.
(c'est assez rudimentaire et écoute trop de messages, mais dans un premier temps...)
// TODO: [in game] send move + elapsed time (in milliseconds); in case of "lastate" message too
+// TODO: if I'm an observer and player(s) disconnect/reconnect, how to find me ?
+// onClick :: ask full game to remote player, and register as an observer in game
+// (use gameId to communicate)
+// on landing on game :: if gameId not found locally, check remotely
+// ==> il manque un param dans game : "remoteId"
- //BaseGame(:variant="variant.name" @game-over=".....TODO")
- //localStorage["score"] = score;
-
-
+ BaseGame(:vname="variant.name" :analyze="analyze"
+ :vr="vr" :fen-start="fenStart" :players="players" :mycolor="mycolor"
+ ref="basegame" @newmove="processMove")
.button-group(v-if="mode!='analyze'")
button(@click="offerDraw") Draw
button(@click="abortGame") Abort
.button-group(v-if="mode!='analyze'")
button(@click="offerDraw") Draw
button(@click="abortGame") Abort
-// TODO: if I'm an observer and player(s) disconnect/reconnect, how to find me ?
-// onClick :: ask full game to remote player, and register as an observer in game
-// (use gameId to communicate)
-// on landing on game :: if gameId not found locally, check remotely
-// ==> il manque un param dans game : "remoteId"
import Board from "@/components/Board.vue";
//import Chat from "@/components/Chat.vue";
//import MoveList from "@/components/MoveList.vue";
import Board from "@/components/Board.vue";
//import Chat from "@/components/Chat.vue";
//import MoveList from "@/components/MoveList.vue";
// gameId: to find the game in storage (assumption: it exists)
// mode: "live" or "corr" (correspondance game), or "analyze"
// gameRef in URL hash (listen for changes)
// gameId: to find the game in storage (assumption: it exists)
// mode: "live" or "corr" (correspondance game), or "analyze"
// gameRef in URL hash (listen for changes)
+ // variables passed to BaseGame:
+ fenStart: "",
+ vr: null,
+ players: ["Myself","Computer"], //always playing white for now
+ mycolor: "w",
+ ////////////
+ gid: "", //given in URL
+ mode: "live", //or "corr"
+ variant: {}, //TODO
// TODO: if I'm one of the players in game, then:
// Send ping to server (answer pong if opponent[s] is connected)
if (true && !!this.conn && !!this.gameRef)
// TODO: if I'm one of the players in game, then:
// Send ping to server (answer pong if opponent[s] is connected)
if (true && !!this.conn && !!this.gameRef)