42_ft_transcendence/frontend/static/js/views/TicTacToeOnlineView.js

46 lines
2.0 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.height = 660;
this.width = 660;
}
async postInit()
{
this.Morpion = new TicTacToe(this.height, this.width, 60, 60, document.getElementById("Morpion"));
this.Morpion.DrawSuperMorpion();
this.Morpion.SetOutline("#43d166");
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://cdn.discordapp.com/attachments/1089527100681240716/1219360784224616498/Snapinsta.app_424926392_1109913580191337_8974514051687331181_n_1080.jpg?ex=660b0539&is=65f89039&hm=25dbcab44e50ec8ca3019dab476293a1001c224c6b6312bd9e30fba1f72667b5&">
<img src="https://cdn.discordapp.com/attachments/447859443867189250/1221824821680275576/cat-thumbs-up-middle-finger-cat.png?ex=6613fc09&is=66018709&hm=d901ea182d58ce0ab80fbcc119ae0b769f318c448ae55a6500607ddb8b3f6ff8&">
<img src="https://cdn.discordapp.com/attachments/447859443867189250/1221824792148316180/thumbs-up-cat.png?ex=6613fc02&is=66018702&hm=16748a2df0cb8e8f111c0817ea456289333aa0f8047821e7ae4ea2e57720e843&">
<img src="https://cdn.discordapp.com/attachments/447859443867189250/1221824753686548580/catthumbsup-cat.png?ex=6613fbf9&is=660186f9&hm=94e93b8db9f72fc146942dedf167a3d7476b3dced95ed5c3e80a4ccce8e27f9e&">`;
}
}