added play button
This commit is contained in:
parent
34fef7be0a
commit
890036094a
5 changed files with 56 additions and 4 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -20,6 +20,7 @@
|
||||||
.menu-item {
|
.menu-item {
|
||||||
position: relative;
|
position: relative;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
.menu-item > a {
|
.menu-item > a {
|
||||||
color: white;
|
color: white;
|
||||||
|
|
@ -124,11 +125,17 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let currentScript = null;
|
let currentScript = null;
|
||||||
|
|
||||||
|
function removePlayButton() {
|
||||||
|
const btn = document.getElementById("playButton");
|
||||||
|
if (btn) btn.remove();
|
||||||
|
}
|
||||||
|
|
||||||
function loadText(scriptName, nb) {
|
function loadText(scriptName, nb) {
|
||||||
if (window.cleanup) {
|
if (window.cleanup) {
|
||||||
window.cleanup();
|
window.cleanup();
|
||||||
}
|
}
|
||||||
|
removePlayButton();
|
||||||
window.txtNumber = nb;
|
window.txtNumber = nb;
|
||||||
|
|
||||||
const container = document.getElementById("anotherCanvasContainer");
|
const container = document.getElementById("anotherCanvasContainer");
|
||||||
|
|
@ -150,6 +157,7 @@
|
||||||
if (window.cleanup) {
|
if (window.cleanup) {
|
||||||
window.cleanup();
|
window.cleanup();
|
||||||
}
|
}
|
||||||
|
removePlayButton();
|
||||||
|
|
||||||
const container = document.getElementById("canvasContainer");
|
const container = document.getElementById("canvasContainer");
|
||||||
container.innerHTML = `<canvas id="myCanvas" width="1000" height="1000"></canvas>`;
|
container.innerHTML = `<canvas id="myCanvas" width="1000" height="1000"></canvas>`;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,28 @@ import { Deck } from "../deck";
|
||||||
import { Hand } from "../hand";
|
import { Hand } from "../hand";
|
||||||
import { Game } from "../game";
|
import { Game } from "../game";
|
||||||
|
|
||||||
|
function showPlayButton() {
|
||||||
|
const button = document.createElement('button');
|
||||||
|
button.id = 'playButton';
|
||||||
|
button.textContent = 'Jouer';
|
||||||
|
button.style.position = 'absolute';
|
||||||
|
button.style.left = `${1050/2}px`;
|
||||||
|
button.style.top = `${1050/2}px`;
|
||||||
|
button.style.transform = 'translate(-50%, -50%)';
|
||||||
|
button.style.fontSize = '2rem';
|
||||||
|
button.style.padding = '1em 2em';
|
||||||
|
button.style.zIndex = '1000';
|
||||||
|
|
||||||
|
document.body.appendChild(button);
|
||||||
|
|
||||||
|
button.addEventListener('click', async () => {
|
||||||
|
button.disabled = true;
|
||||||
|
button.textContent = 'Chargement...';
|
||||||
|
await initDisplay();
|
||||||
|
button.remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
class RiichiGameManager {
|
class RiichiGameManager {
|
||||||
// Configuration globale
|
// Configuration globale
|
||||||
private readonly CANVAS_ID: string = "myCanvas";
|
private readonly CANVAS_ID: string = "myCanvas";
|
||||||
|
|
@ -249,5 +271,5 @@ declare global {
|
||||||
|
|
||||||
// Initialisation automatique si le script est chargé directement
|
// Initialisation automatique si le script est chargé directement
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
initDisplay().catch(console.error);
|
showPlayButton();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,28 @@ import { Deck } from "../deck";
|
||||||
import { Hand } from "../hand";
|
import { Hand } from "../hand";
|
||||||
import { Game } from "../game";
|
import { Game } from "../game";
|
||||||
|
|
||||||
|
function showPlayButton() {
|
||||||
|
const button = document.createElement('button');
|
||||||
|
button.id = 'playButton';
|
||||||
|
button.textContent = 'Jouer';
|
||||||
|
button.style.position = 'absolute';
|
||||||
|
button.style.left = `${1050/2}px`;
|
||||||
|
button.style.top = `${1050/2}px`;
|
||||||
|
button.style.transform = 'translate(-50%, -50%)';
|
||||||
|
button.style.fontSize = '2rem';
|
||||||
|
button.style.padding = '1em 2em';
|
||||||
|
button.style.zIndex = '1000';
|
||||||
|
|
||||||
|
document.body.appendChild(button);
|
||||||
|
|
||||||
|
button.addEventListener('click', async () => {
|
||||||
|
button.disabled = true;
|
||||||
|
button.textContent = 'Chargement...';
|
||||||
|
await initDisplay();
|
||||||
|
button.remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
class RiichiGameManager {
|
class RiichiGameManager {
|
||||||
// Configuration globale
|
// Configuration globale
|
||||||
private readonly CANVAS_ID: string = "myCanvas";
|
private readonly CANVAS_ID: string = "myCanvas";
|
||||||
|
|
@ -252,5 +274,5 @@ declare global {
|
||||||
|
|
||||||
// Initialisation automatique si le script est chargé directement
|
// Initialisation automatique si le script est chargé directement
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
initDisplay().catch(console.error);
|
showPlayButton();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue