42_ft_transcendence/frontend/static/js/views/TicTacToeOnlineView.js
2024-05-07 16:28:52 +02:00

46 lines
1.4 KiB
JavaScript

import AbstractView from "./abstracts/AbstractView.js";
import { lang } from "../index.js";
import { TicTacToe } from "../api/game/tictactoe/TicTacToeGame.js"
export class TicTacToeOnlineView extends AbstractView
{
constructor(params, titleKey)
{
super(params, lang.get('ticTacToeTitle'));
this.params = params;
this.titleKey = titleKey;
this.game_id = params.id;
this.height = 660;
this.width = 660;
}
async postInit()
{
this.Morpion = new TicTacToe(this.height, this.width, 60, 60, document.getElementById("Morpion"), this.game_id);
this.Morpion.DrawSuperMorpion();
await this.Morpion.init();
}
async leavePage()
{
this.Morpion.uninit();
}
setTitle()
{
document.title = lang.get(this.titleKey, this.titleKey);
}
async getHtml() {
return `
<link rel="stylesheet" href="/static/css/tictactoe.css">
<div id="canva">
<canvas id="Morpion" width="${this.width}" height="${this.height}"></canvas>
</div>
<h1>Work in progress bozo</h1>
<img src="https://i.imgur.com/hh4yjO9.jpeg&">
<img src="https://i.imgur.com/TpOtHY6.png&">
<img src="https://i.imgur.com/O8F314O.jpeg&">
<img src = "https://cdn.discordapp.com/attachments/447859443867189250/1237410279168544809/image3.png?ex=663b8ba0&is=663a3a20&hm=8de0e952c8c41b5b40a49b6456c58e9b3f968e18674b868fefa9f7054bbda07f&"`;
}
}