add: tictactoe: timers on catchup
This commit is contained in:
@ -86,8 +86,7 @@ export default class extends AbstractView {
|
||||
games.forEach(game => {
|
||||
if (game.finished === false)
|
||||
return
|
||||
|
||||
if (this.profile.id === game.winner.id)
|
||||
if (this.profile.id === game.winner?.id)
|
||||
win++;
|
||||
else
|
||||
lose++;
|
||||
@ -114,10 +113,16 @@ export default class extends AbstractView {
|
||||
let game_item = document.createElement("div");
|
||||
game_item.className = "game-item";
|
||||
game_item.style.backgroundColor = "grey";
|
||||
if (game.started)
|
||||
game_item.style.backgroundColor = "yellow";
|
||||
if (game.finished)
|
||||
if (game.finished && game.winner == null)
|
||||
game_item.style.backgroundColor = "red";
|
||||
else if (game.finished)
|
||||
game_item.style.backgroundColor = this.profile.id === game.winner.id ? "green" : "red";
|
||||
else if (game.started)
|
||||
game_item.style.backgroundColor = "yellow";
|
||||
|
||||
let gametype = document.createElement("b");
|
||||
gametype.innerText = `${(game.game_type == "tictactoe") ? lang.get("ticTacToeTitle") : "Pong"}`;
|
||||
game_item.appendChild(gametype);
|
||||
|
||||
game.players.forEach(player => {
|
||||
let player_score = document.createElement("a");
|
||||
@ -128,7 +133,6 @@ export default class extends AbstractView {
|
||||
|
||||
game_item.appendChild(player_score);
|
||||
});
|
||||
|
||||
a.appendChild(game_item);
|
||||
game_list.appendChild(a);
|
||||
});
|
||||
|
@ -1,12 +1,12 @@
|
||||
import AbstractView from "./abstracts/AbstractView.js";
|
||||
import { lang } from "../index.js";
|
||||
import { TicTacToe } from "../api/game/tictactoe/TicTacToeGame.js"
|
||||
|
||||
export class TicTacToeOnlineView extends AbstractView
|
||||
import AbstractAuthenticatedView from "./abstracts/AbstractAuthenticatedView.js";
|
||||
import { navigateTo } from "../index.js"
|
||||
export class TicTacToeOnlineView extends AbstractAuthenticatedView
|
||||
{
|
||||
constructor(params, titleKey)
|
||||
{
|
||||
super(params, lang.get('ticTacToeTitle'));
|
||||
super(params, 'ticTacToeTitle');
|
||||
this.params = params;
|
||||
this.titleKey = titleKey;
|
||||
this.game_id = params.id;
|
||||
|
Reference in New Issue
Block a user