isConnected: function(index) {
const player = this.game.players[index];
// Is it me ? In this case no need to bother with focus
isConnected: function(index) {
const player = this.game.players[index];
// Is it me ? In this case no need to bother with focus
// Still have to check for name (because of potential multi-accounts
// on same browser, although this should be rare...)
return (!this.st.user.name || this.st.user.name == player.name);
// Still have to check for name (because of potential multi-accounts
// on same browser, although this should be rare...)
return (!this.st.user.name || this.st.user.name == player.name);
const gtype = this.getGameType(game);
const tc = extractTime(game.cadence);
const myIdx = game.players.findIndex(p => {
const gtype = this.getGameType(game);
const tc = extractTime(game.cadence);
const myIdx = game.players.findIndex(p => {
});
const mycolor = [undefined, "w", "b"][myIdx + 1]; //undefined for observers
if (!game.chats) game.chats = []; //live games don't have chat history
});
const mycolor = [undefined, "w", "b"][myIdx + 1]; //undefined for observers
if (!game.chats) game.chats = []; //live games don't have chat history
// opponent sid not strictly required (or available), but easier
// at least oppsid or oppid is available anyway:
oppsid: myIdx < 0 ? undefined : game.players[1 - myIdx].sid,
// opponent sid not strictly required (or available), but easier
// at least oppsid or oppid is available anyway:
oppsid: myIdx < 0 ? undefined : game.players[1 - myIdx].sid,
this.game.scoreMsg = scoreMsg;
this.$set(this.game, "scoreMsg", scoreMsg);
const myIdx = this.game.players.findIndex(p => {
this.game.scoreMsg = scoreMsg;
this.$set(this.game, "scoreMsg", scoreMsg);
const myIdx = this.game.players.findIndex(p => {