- // TODO: process some opponent's move
-
- // update storage (corr or live), send move to opponent (if ours) /
- // notify BaseGame if opponents move (how ?) --> need a game.newmove field ?
+ if (!this.game.mycolor)
+ return; //I'm just an observer
+ // TODO: update storage (corr or live),
+ GameStorage.update({
+ fen: move: clocks: ................ // TODO
+ });
+ // Send move ("newmove" event) to opponent(s) (if ours)
+ if (move.disappear[0].c == this.game.mycolor)
+ {
+ this.game.players.forEach(p => {
+ if (p.sid != this.st.user.sid)
+ this.st.conn.send("newmove", {target:p.sid, move:move});
+ });
+ }
+ },
+ gameOver: function(score) {
+ // TODO: GameStorage.update with score
+ // NOTE: this update function should also work for corr games