APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
f78e380236
commit
2b33e31589
4 files changed
+423
-119
No files matched your search
+87
-20
@@ -267,7 +267,7 @@
|
||||
|
||||
<div class="game-card">
|
||||
<div class="header-bar">
|
||||
<div>🦖 <strong>Chrome T-Rex Runner</strong></div>
|
||||
<div>🦖 <strong id="dinoTitleText">Chrome T-Rex Runner</strong></div>
|
||||
<div class="scores">
|
||||
<span class="hi">HI <span id="hiScore">00000</span></span>
|
||||
<span id="currentScore">00000</span>
|
||||
@@ -277,20 +277,20 @@
|
||||
<div class="canvas-wrap" id="canvasWrap">
|
||||
<canvas id="dinoCanvas" width="640" height="220"></canvas>
|
||||
<div id="gameOverlay" class="overlay-message" style="display:none">
|
||||
<h2>G A M E O V E R</h2>
|
||||
<button class="restart-btn" onclick="resetGame()">🔄 REJOUER (Espace)</button>
|
||||
<h2 id="dinoGameOverText">G A M E O V E R</h2>
|
||||
<button id="dinoRestartBtn" class="restart-btn" onclick="resetGame()">🔄 REJOUER (Espace)</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="controls-hint">
|
||||
<div><kbd>Espace</kbd> ou <kbd>⬆️</kbd> : Sauter</div>
|
||||
<div><kbd>⬇️</kbd> : Se baisser / descente rapide</div>
|
||||
<div>Toucher l'écran pour sauter</div>
|
||||
<div class="controls-hint" id="dinoControlsHint">
|
||||
<div id="dinoHintJump"><kbd>Espace</kbd> ou <kbd>⬆️</kbd> : Sauter</div>
|
||||
<div id="dinoHintDuck"><kbd>⬇️</kbd> : Se baisser / descente rapide</div>
|
||||
<div id="dinoHintTouch">Toucher l'écran pour sauter</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Theme Management
|
||||
// Theme & i18n Management
|
||||
function setTheme(theme, macosMode) {
|
||||
if (!theme) theme = 'dark';
|
||||
document.documentElement.dataset.theme = theme;
|
||||
@@ -304,10 +304,51 @@
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
|
||||
|
||||
// Dictionnaire i18n
|
||||
const I18N_DINO = {
|
||||
fr: {
|
||||
title: "Chrome T-Rex Runner",
|
||||
game_over: "G A M E O V E R",
|
||||
restart_btn: "🔄 REJOUER (Espace)",
|
||||
hint_jump: "<kbd>Espace</kbd> ou <kbd>⬆️</kbd> : Sauter",
|
||||
hint_duck: "<kbd>⬇️</kbd> : Se baisser / descente rapide",
|
||||
hint_touch: "Toucher l'écran pour sauter"
|
||||
},
|
||||
en: {
|
||||
title: "Chrome T-Rex Runner",
|
||||
game_over: "G A M E O V E R",
|
||||
restart_btn: "🔄 REPLAY (Space)",
|
||||
hint_jump: "<kbd>Space</kbd> or <kbd>⬆️</kbd>: Jump",
|
||||
hint_duck: "<kbd>⬇️</kbd>: Duck / Fast drop",
|
||||
hint_touch: "Tap screen to jump"
|
||||
}
|
||||
};
|
||||
|
||||
function applyDinoLang(lang) {
|
||||
const l = (lang && (lang.startsWith('en') ? 'en' : 'fr')) || 'fr';
|
||||
const dict = I18N_DINO[l] || I18N_DINO.fr;
|
||||
const tEl = document.getElementById('dinoTitleText');
|
||||
const goEl = document.getElementById('dinoGameOverText');
|
||||
const rbEl = document.getElementById('dinoRestartBtn');
|
||||
const hjEl = document.getElementById('dinoHintJump');
|
||||
const hdEl = document.getElementById('dinoHintDuck');
|
||||
const htEl = document.getElementById('dinoHintTouch');
|
||||
if (tEl) tEl.textContent = dict.title;
|
||||
if (goEl) goEl.innerHTML = dict.game_over;
|
||||
if (rbEl) rbEl.textContent = dict.restart_btn;
|
||||
if (hjEl) hjEl.innerHTML = dict.hint_jump;
|
||||
if (hdEl) hdEl.innerHTML = dict.hint_duck;
|
||||
if (htEl) htEl.textContent = dict.hint_touch;
|
||||
}
|
||||
applyDinoLang(urlParams.get('lang'));
|
||||
|
||||
window.addEventListener('message', e => {
|
||||
if (e.data && e.data.type === 'themeChange') {
|
||||
setTheme(e.data.theme, e.data.macosMode);
|
||||
}
|
||||
if (e.data && e.data.type === 'langChange') {
|
||||
applyDinoLang(e.data.lang);
|
||||
}
|
||||
});
|
||||
|
||||
function getThemeProp(name, fallback) {
|
||||
@@ -367,7 +408,7 @@
|
||||
let gameOver = false;
|
||||
let score = 0;
|
||||
let gameSpeed = 6;
|
||||
let nextObstacleTimer = 0;
|
||||
let nextObstacleTimer = 90; // Période de grâce au lancement
|
||||
let isNight = false;
|
||||
|
||||
// Dinosaur
|
||||
@@ -436,6 +477,7 @@
|
||||
gameStarted = true;
|
||||
score = 0;
|
||||
gameSpeed = 6;
|
||||
nextObstacleTimer = 90; // Période de grâce de 1.5s à chaque reprise
|
||||
obstacles = [];
|
||||
dino.y = GROUND_Y - 44;
|
||||
dino.vy = 0;
|
||||
@@ -448,12 +490,35 @@
|
||||
}
|
||||
|
||||
function spawnObstacle() {
|
||||
const type = (score > 250 && Math.random() < 0.3) ? 'ptero' : 'cactus';
|
||||
// Les ptérodactyles n'apparaissent qu'à partir de 450 points
|
||||
const allowPtero = score > 450;
|
||||
const type = (allowPtero && Math.random() < 0.28) ? 'ptero' : 'cactus';
|
||||
|
||||
if (type === 'cactus') {
|
||||
const isBig = Math.random() < 0.4;
|
||||
const count = isBig ? (Math.random() < 0.5 ? 2 : 1) : Math.floor(Math.random() * 3) + 1;
|
||||
let isBig = false;
|
||||
let count = 1;
|
||||
|
||||
// Difficulté progressive équitable
|
||||
if (score < 100) {
|
||||
// Début : 1 seul petit cactus (accessible pour s'échauffer)
|
||||
isBig = false;
|
||||
count = 1;
|
||||
} else if (score < 250) {
|
||||
// 1 cactus petit ou grand
|
||||
isBig = Math.random() < 0.45;
|
||||
count = 1;
|
||||
} else if (score < 450) {
|
||||
// 1 ou 2 cactus
|
||||
isBig = Math.random() < 0.4;
|
||||
count = Math.random() < 0.6 ? 1 : 2;
|
||||
} else {
|
||||
// Vitesse élevée : jusqu'à 3 petits ou 2 grands
|
||||
isBig = Math.random() < 0.45;
|
||||
count = isBig ? (Math.random() < 0.65 ? 1 : 2) : (Math.floor(Math.random() * 3) + 1);
|
||||
}
|
||||
|
||||
const w = (isBig ? 24 : 16) * count;
|
||||
const h = isBig ? 46 : 34;
|
||||
const h = isBig ? 44 : 32;
|
||||
obstacles.push({
|
||||
type: 'cactus',
|
||||
x: canvas.width + 20,
|
||||
@@ -463,8 +528,8 @@
|
||||
isBig: isBig
|
||||
});
|
||||
} else {
|
||||
// Pterodactyl fly height (low, mid, high)
|
||||
const heights = [GROUND_Y - 32, GROUND_Y - 55, GROUND_Y - 80];
|
||||
// Ptérodactyles : hauteurs adaptées (haut = passer dessous, bas = sauter par dessus)
|
||||
const heights = [GROUND_Y - 32, GROUND_Y - 55, GROUND_Y - 78];
|
||||
const h = heights[Math.floor(Math.random() * heights.length)];
|
||||
obstacles.push({
|
||||
type: 'ptero',
|
||||
@@ -479,7 +544,7 @@
|
||||
}
|
||||
|
||||
function checkCollision(r1, r2) {
|
||||
const p = 6;
|
||||
const p = 8; // Marge de tolérance équitable pour les collisions
|
||||
return (
|
||||
r1.x + p < r2.x + r2.width &&
|
||||
r1.x + r1.width - p > r2.x &&
|
||||
@@ -632,12 +697,14 @@
|
||||
dino.legTimer = 0;
|
||||
}
|
||||
|
||||
// Obstacle timer
|
||||
nextObstacleTimer -= gameSpeed;
|
||||
// Décompte de l'obstacle : 1 frame par itération pour un timing stable
|
||||
nextObstacleTimer -= 1;
|
||||
if (nextObstacleTimer <= 0) {
|
||||
spawnObstacle();
|
||||
// Random interval based on speed
|
||||
nextObstacleTimer = Math.floor(Math.random() * 60) + (100 - Math.min(gameSpeed * 5, 50));
|
||||
// Intervalle équitable garantissant au joueur le temps de réatterrir (minimum 50 frames même à pleine vitesse)
|
||||
const minFrames = Math.max(50, 95 - Math.floor(score / 40));
|
||||
const randomVariance = Math.floor(Math.random() * 45);
|
||||
nextObstacleTimer = minFrames + randomVariance;
|
||||
}
|
||||
|
||||
// Move obstacles
|
||||
|
||||
+152
-45
@@ -133,25 +133,36 @@
|
||||
.sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
width: 140px;
|
||||
gap: 8px;
|
||||
width: 154px;
|
||||
}
|
||||
.panel-box {
|
||||
background: var(--panel-box);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.panel-box h3 {
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
color: var(--muted);
|
||||
margin-bottom: 6px;
|
||||
.stats-box {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 2px;
|
||||
padding: 6px 2px;
|
||||
}
|
||||
.panel-box .value {
|
||||
font-size: 20px;
|
||||
.stat-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.stat-col h3 {
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: var(--muted);
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.stat-col .value {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: var(--blue);
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
@@ -163,14 +174,19 @@
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
}
|
||||
.btn-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 6px;
|
||||
}
|
||||
.btn {
|
||||
background: var(--blue);
|
||||
color: var(--blue-btn-text);
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
padding: 8px 12px;
|
||||
padding: 7px 8px;
|
||||
font-weight: 700;
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition: all .15s ease;
|
||||
width: 100%;
|
||||
@@ -184,12 +200,12 @@
|
||||
}
|
||||
.btn.secondary:hover { opacity: 0.85; }
|
||||
.controls-help {
|
||||
font-size: 11px;
|
||||
font-size: 10.5px;
|
||||
color: var(--muted);
|
||||
line-height: 1.5;
|
||||
line-height: 1.45;
|
||||
background: rgba(0,0,0,0.12);
|
||||
border-radius: 6px;
|
||||
padding: 8px;
|
||||
padding: 6px 8px;
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.controls-help kbd {
|
||||
@@ -257,37 +273,41 @@
|
||||
<div id="gameOverlay" class="overlay-msg" style="display:none">
|
||||
<h2 id="overlayTitle">GAME OVER</h2>
|
||||
<div id="overlayScore" style="color:var(--blue);font-size:16px;font-weight:700">Score: 0</div>
|
||||
<button class="btn" style="width:auto;padding:8px 24px" onclick="startGame()">REJOUER</button>
|
||||
<button id="overlayReplayBtn" class="btn" style="width:auto;padding:8px 24px" onclick="startGame()">REJOUER</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sidebar">
|
||||
<div class="panel-box">
|
||||
<h3>Prochaine</h3>
|
||||
<canvas id="next" class="preview-canvas" width="80" height="80"></canvas>
|
||||
<div class="panel-box" style="padding:6px">
|
||||
<h3 id="labelNext" style="font-size:10px;margin-bottom:4px">Prochaine</h3>
|
||||
<canvas id="next" class="preview-canvas" width="80" height="74"></canvas>
|
||||
</div>
|
||||
<div class="panel-box">
|
||||
<h3>Score</h3>
|
||||
<div id="score" class="value">0</div>
|
||||
<div class="panel-box stats-box">
|
||||
<div class="stat-col">
|
||||
<h3 id="labelScore">Score</h3>
|
||||
<div id="score" class="value">0</div>
|
||||
</div>
|
||||
<div class="stat-col" style="border-left:1px solid var(--border);border-right:1px solid var(--border)">
|
||||
<h3 id="labelLines">Lignes</h3>
|
||||
<div id="lines" class="value">0</div>
|
||||
</div>
|
||||
<div class="stat-col">
|
||||
<h3 id="labelLevel">Niveau</h3>
|
||||
<div id="level" class="value">1</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-box">
|
||||
<h3>Lignes</h3>
|
||||
<div id="lines" class="value">0</div>
|
||||
<div class="btn-row">
|
||||
<button id="pauseBtn" class="btn secondary" style="padding:6px 2px;font-size:11px" onclick="togglePause()">⏸️ Pause</button>
|
||||
<button id="musicBtn" class="btn secondary" style="padding:6px 2px;font-size:11px" onclick="toggleMusic()">🎵 Son</button>
|
||||
</div>
|
||||
<div class="panel-box">
|
||||
<h3>Niveau</h3>
|
||||
<div id="level" class="value">1</div>
|
||||
</div>
|
||||
<button id="pauseBtn" class="btn secondary" onclick="togglePause()">PAUSE (P)</button>
|
||||
<button id="musicBtn" class="btn secondary" onclick="toggleMusic()">🎵 Musique : ON</button>
|
||||
<button class="btn" onclick="startGame()">NOUVEAU</button>
|
||||
<button id="newGameBtn" class="btn" style="padding:7px;font-size:12px" onclick="startGame()">▶ Nouveau</button>
|
||||
|
||||
<div class="controls-help">
|
||||
<div><kbd>⬅️</kbd> <kbd>➡️</kbd> : Gauche / Droite</div>
|
||||
<div><kbd>⬆️</kbd> : Pivoter</div>
|
||||
<div><kbd>⬇️</kbd> : Chute rapide</div>
|
||||
<div><kbd>Espace</kbd> : Drop direct</div>
|
||||
<div><kbd>P</kbd> : Mettre en pause</div>
|
||||
<div id="cmdMove"><kbd>⬅️</kbd> <kbd>➡️</kbd> : Gauche / Droite</div>
|
||||
<div id="cmdRotate"><kbd>⬆️</kbd> : Pivoter</div>
|
||||
<div id="cmdSoftDrop"><kbd>⬇️</kbd> : Descente rapide</div>
|
||||
<div id="cmdHardDrop"><kbd>Espace</kbd> : Drop direct</div>
|
||||
<div id="cmdPause"><kbd>P</kbd> : Mettre en pause</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -301,7 +321,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Theme Management
|
||||
// Theme & i18n Management
|
||||
function setTheme(theme, macosMode) {
|
||||
if (!theme) theme = 'dark';
|
||||
document.documentElement.dataset.theme = theme;
|
||||
@@ -316,10 +336,91 @@
|
||||
}
|
||||
}
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
|
||||
|
||||
const I18N_TETRIS = {
|
||||
fr: {
|
||||
next: "Prochaine",
|
||||
score: "Score",
|
||||
lines: "Lignes",
|
||||
level: "Niveau",
|
||||
pause: "⏸️ Pause (P)",
|
||||
resume: "▶️ Reprendre",
|
||||
music_on: "🎵 Musique : ON",
|
||||
music_off: "🔇 Musique : OFF",
|
||||
new_game: "▶ Nouveau",
|
||||
replay: "REJOUER",
|
||||
game_over: "GAME OVER",
|
||||
paused_title: "EN PAUSE",
|
||||
cmd_move: "<kbd>⬅️</kbd> <kbd>➡️</kbd> : Gauche / Droite",
|
||||
cmd_rotate: "<kbd>⬆️</kbd> : Pivoter",
|
||||
cmd_soft_drop: "<kbd>⬇️</kbd> : Descente rapide",
|
||||
cmd_hard_drop: "<kbd>Espace</kbd> : Drop direct",
|
||||
cmd_pause: "<kbd>P</kbd> : Mettre en pause"
|
||||
},
|
||||
en: {
|
||||
next: "Next",
|
||||
score: "Score",
|
||||
lines: "Lines",
|
||||
level: "Level",
|
||||
pause: "⏸️ Pause (P)",
|
||||
resume: "▶️ Resume",
|
||||
music_on: "🎵 Music: ON",
|
||||
music_off: "🔇 Music: OFF",
|
||||
new_game: "▶ New Game",
|
||||
replay: "RESTART",
|
||||
game_over: "GAME OVER",
|
||||
paused_title: "PAUSED",
|
||||
cmd_move: "<kbd>⬅️</kbd> <kbd>➡️</kbd>: Left / Right",
|
||||
cmd_rotate: "<kbd>⬆️</kbd>: Rotate",
|
||||
cmd_soft_drop: "<kbd>⬇️</kbd>: Soft drop",
|
||||
cmd_hard_drop: "<kbd>Space</kbd>: Hard drop",
|
||||
cmd_pause: "<kbd>P</kbd>: Pause game"
|
||||
}
|
||||
};
|
||||
|
||||
let currentTetrisLang = 'fr';
|
||||
function applyTetrisLang(lang) {
|
||||
currentTetrisLang = (lang && (lang.startsWith('en') ? 'en' : 'fr')) || 'fr';
|
||||
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||
const ln = document.getElementById('labelNext');
|
||||
const ls = document.getElementById('labelScore');
|
||||
const ll = document.getElementById('labelLines');
|
||||
const lv = document.getElementById('labelLevel');
|
||||
const pb = document.getElementById('pauseBtn');
|
||||
const mb = document.getElementById('musicBtn');
|
||||
const nb = document.getElementById('newGameBtn');
|
||||
const rb = document.getElementById('overlayReplayBtn');
|
||||
const cm = document.getElementById('cmdMove');
|
||||
const cr = document.getElementById('cmdRotate');
|
||||
const cs = document.getElementById('cmdSoftDrop');
|
||||
const ch = document.getElementById('cmdHardDrop');
|
||||
const cp = document.getElementById('cmdPause');
|
||||
|
||||
if (ln) ln.textContent = dict.next;
|
||||
if (ls) ls.textContent = dict.score;
|
||||
if (ll) ll.textContent = dict.lines;
|
||||
if (lv) lv.textContent = dict.level;
|
||||
if (pb) pb.textContent = (typeof isPaused !== 'undefined' && isPaused) ? dict.resume : dict.pause;
|
||||
if (mb) mb.textContent = (typeof isMusicEnabled !== 'undefined' && !isMusicEnabled) ? dict.music_off : dict.music_on;
|
||||
if (nb) nb.textContent = dict.new_game;
|
||||
if (rb) rb.textContent = dict.replay;
|
||||
if (cm) cm.innerHTML = dict.cmd_move;
|
||||
if (cr) cr.innerHTML = dict.cmd_rotate;
|
||||
if (cs) cs.innerHTML = dict.cmd_soft_drop;
|
||||
if (ch) ch.innerHTML = dict.cmd_hard_drop;
|
||||
if (cp) cp.innerHTML = dict.cmd_pause;
|
||||
}
|
||||
applyTetrisLang(urlParams.get('lang'));
|
||||
|
||||
window.addEventListener('message', e => {
|
||||
if (e.data && e.data.type === 'themeChange') {
|
||||
setTheme(e.data.theme, e.data.macosMode);
|
||||
}
|
||||
if (e.data && e.data.type === 'langChange') {
|
||||
applyTetrisLang(e.data.lang);
|
||||
}
|
||||
});
|
||||
|
||||
// Audio synthesizer
|
||||
@@ -473,8 +574,9 @@
|
||||
|
||||
function toggleMusic() {
|
||||
isMusicEnabled = !isMusicEnabled;
|
||||
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||
const btn = document.getElementById('musicBtn');
|
||||
if (btn) btn.textContent = isMusicEnabled ? '🎵 Musique : ON' : '🔇 Musique : OFF';
|
||||
if (btn) btn.textContent = isMusicEnabled ? dict.music_on : dict.music_off;
|
||||
if (isMusicEnabled) {
|
||||
if (!isPaused && !isGameOver) scheduleMusic();
|
||||
} else {
|
||||
@@ -641,9 +743,11 @@
|
||||
isGameOver = true;
|
||||
stopMusic();
|
||||
playSound('gameover');
|
||||
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||
document.getElementById('gameOverlay').style.display = 'flex';
|
||||
document.getElementById('overlayTitle').textContent = 'GAME OVER';
|
||||
document.getElementById('overlayScore').textContent = 'Score final : ' + player.score;
|
||||
document.getElementById('overlayTitle').textContent = dict.game_over;
|
||||
document.getElementById('overlayScore').textContent = (currentTetrisLang.startsWith('en') ? 'Final Score: ' : 'Score final : ') + player.score;
|
||||
document.getElementById('overlayReplayBtn').textContent = dict.replay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,13 +831,15 @@
|
||||
function togglePause() {
|
||||
if (isGameOver) return;
|
||||
isPaused = !isPaused;
|
||||
document.getElementById('pauseBtn').textContent = isPaused ? 'REPRENDRE' : 'PAUSE (P)';
|
||||
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||
document.getElementById('pauseBtn').textContent = isPaused ? dict.resume : dict.pause;
|
||||
const ov = document.getElementById('gameOverlay');
|
||||
if (isPaused) {
|
||||
stopMusic();
|
||||
ov.style.display = 'flex';
|
||||
document.getElementById('overlayTitle').textContent = 'PAUSE';
|
||||
document.getElementById('overlayTitle').textContent = dict.paused_title;
|
||||
document.getElementById('overlayScore').textContent = 'Score: ' + player.score;
|
||||
document.getElementById('overlayReplayBtn').textContent = dict.replay;
|
||||
} else {
|
||||
ov.style.display = 'none';
|
||||
lastTime = performance.now();
|
||||
@@ -869,8 +975,9 @@
|
||||
dropInterval = 1000;
|
||||
isGameOver = false;
|
||||
isPaused = false;
|
||||
const dict = I18N_TETRIS[currentTetrisLang] || I18N_TETRIS.fr;
|
||||
document.getElementById('gameOverlay').style.display = 'none';
|
||||
document.getElementById('pauseBtn').textContent = 'PAUSE (P)';
|
||||
document.getElementById('pauseBtn').textContent = dict.pause;
|
||||
updateScore();
|
||||
nextPiece = null;
|
||||
playerReset();
|
||||
|
||||
+132
-29
@@ -303,14 +303,14 @@
|
||||
}
|
||||
|
||||
.bottom-actions {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1.25fr;
|
||||
gap: 10px;
|
||||
margin-top: 16px;
|
||||
width: 100%;
|
||||
}
|
||||
.btn {
|
||||
flex: 1;
|
||||
padding: 9px 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
@@ -318,16 +318,36 @@
|
||||
border: 1px solid var(--border);
|
||||
background: var(--panel-box);
|
||||
color: var(--text);
|
||||
transition: all 0.15s ease;
|
||||
transition: all 0.2s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
user-select: none;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.15);
|
||||
}
|
||||
.btn:hover {
|
||||
background: var(--cell-hover);
|
||||
border-color: var(--blue);
|
||||
color: var(--blue);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.btn.btn-action-accent {
|
||||
background: rgba(92, 167, 255, 0.12);
|
||||
border-color: var(--blue);
|
||||
color: var(--blue);
|
||||
font-weight: 700;
|
||||
box-shadow: 0 0 10px rgba(92, 167, 255, 0.2);
|
||||
}
|
||||
.btn.btn-action-accent:hover {
|
||||
background: var(--blue);
|
||||
color: var(--blue-btn-text, #ffffff);
|
||||
box-shadow: 0 0 14px rgba(92, 167, 255, 0.4);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.btn:hover { background: var(--cell-hover); border-color: var(--blue); }
|
||||
.btn.primary {
|
||||
background: var(--blue);
|
||||
color: var(--blue-btn-text);
|
||||
color: var(--blue-btn-text, #ffffff);
|
||||
border-color: var(--blue);
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -335,10 +355,10 @@
|
||||
|
||||
.instructions {
|
||||
margin-top: 12px;
|
||||
font-size: 11px;
|
||||
color: #9aa8c5;
|
||||
font-size: 11.5px;
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
line-height: 1.4;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
/* Win overlay */
|
||||
@@ -372,20 +392,20 @@
|
||||
|
||||
<div class="game-container">
|
||||
<div class="top-bar">
|
||||
<div class="title-badge">⚡ <span>Zip</span> <span style="font-size:11px;color:#9aa8c5;font-weight:normal">(LinkedIn)</span></div>
|
||||
<div class="title-badge">⚡ <span>Zip</span> <span style="font-size:11px;color:var(--muted);font-weight:normal">(LinkedIn)</span></div>
|
||||
<div class="level-selector">
|
||||
<select id="levelSelect" onchange="loadSelectedLevel()">
|
||||
<option value="1">Niveau 1 (5×5 Facile)</option>
|
||||
<option value="2">Niveau 2 (5×5 Intermédiaire)</option>
|
||||
<option value="3">Niveau 3 (6×6 Expert)</option>
|
||||
<option value="random">Générateur infini 🎲</option>
|
||||
<option id="optLevel1" value="1">Niveau 1 (5×5 Facile)</option>
|
||||
<option id="optLevel2" value="2">Niveau 2 (5×5 Intermédiaire)</option>
|
||||
<option id="optLevel3" value="3">Niveau 3 (6×6 Expert)</option>
|
||||
<option id="optLevelRandom" value="random">Générateur infini 🎲</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stats-bar">
|
||||
<div>Cases : <strong id="cellCount">1 / 25</strong></div>
|
||||
<div>Objectif : <strong id="nextTargetNum">Atteindre le 2</strong></div>
|
||||
<div><span id="labelCellCount">Cases :</span> <strong id="cellCount">1 / 25</strong></div>
|
||||
<div><span id="labelTarget">Objectif :</span> <strong id="nextTargetNum">Atteindre le 2</strong></div>
|
||||
<div>⏱️ <strong id="timerDisplay">00:00</strong></div>
|
||||
</div>
|
||||
|
||||
@@ -398,26 +418,26 @@
|
||||
<div id="gridEl" class="grid"></div>
|
||||
|
||||
<div id="winOverlay" class="win-overlay" style="display:none">
|
||||
<h2>🎉 FÉLICITATIONS !</h2>
|
||||
<p style="color:#eef4ff;font-size:14px">Grille entièrement résolue !</p>
|
||||
<p id="winTime" style="color:#5ca7ff;font-size:13px;font-weight:bold"></p>
|
||||
<button class="btn primary" onclick="nextLevelOrReplay()" style="margin-top:8px;padding:8px 24px">Niveau suivant ➡️</button>
|
||||
<h2 id="winTitle">🎉 FÉLICITATIONS !</h2>
|
||||
<p id="winSub" style="color:var(--text);font-size:14px">Grille entièrement résolue !</p>
|
||||
<p id="winTime" style="color:var(--blue);font-size:13px;font-weight:bold"></p>
|
||||
<button id="winNextBtn" class="btn primary" onclick="nextLevelOrReplay()" style="margin-top:8px;padding:8px 24px">Niveau suivant ➡️</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bottom-actions">
|
||||
<button class="btn" onclick="undoMove()">↩️ Annuler</button>
|
||||
<button class="btn" onclick="resetCurrentLevel()">🔄 Recommencer</button>
|
||||
<button class="btn primary" onclick="generateRandomLevel()">🎲 Nouveau défi</button>
|
||||
<button id="btnZipUndo" class="btn" onclick="undoMove()">↩️ Annuler</button>
|
||||
<button id="btnZipRestart" class="btn" onclick="resetCurrentLevel()">🔄 Recommencer</button>
|
||||
<button id="btnZipChallenge" class="btn btn-action-accent" onclick="generateRandomLevel()">🎲 Nouveau défi</button>
|
||||
</div>
|
||||
|
||||
<div class="instructions">
|
||||
<div id="zipInstructions" class="instructions">
|
||||
Reliez tous les chiffres dans l'ordre (1 ➔ 2 ➔ 3...) en passant par <strong>TOUTES les cases</strong> de la grille exactement une fois, sans croiser les murs rouges ! (Glissez ou cliquez)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Theme Management
|
||||
// Theme & i18n Management
|
||||
function setTheme(theme, macosMode) {
|
||||
if (!theme) theme = 'dark';
|
||||
document.documentElement.dataset.theme = theme;
|
||||
@@ -431,10 +451,91 @@
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
setTheme(urlParams.get('theme') || 'dark', urlParams.get('macosMode'));
|
||||
|
||||
const I18N_ZIP = {
|
||||
fr: {
|
||||
cell_count: "Cases :",
|
||||
target: "Objectif :",
|
||||
target_reach: "Atteindre le ",
|
||||
target_cover: "Couvrir les {n} case(s) restante(s)",
|
||||
target_done: "Terminé ! 🎉",
|
||||
level_1: "Niveau 1 (5×5 Facile)",
|
||||
level_2: "Niveau 2 (5×5 Intermédiaire)",
|
||||
level_3: "Niveau 3 (6×6 Expert)",
|
||||
level_random: "Générateur infini 🎲",
|
||||
btn_undo: "↩️ Annuler",
|
||||
btn_restart: "🔄 Recommencer",
|
||||
btn_challenge: "🎲 Nouveau défi",
|
||||
win_title: "🎉 FÉLICITATIONS !",
|
||||
win_sub: "Grille entièrement résolue !",
|
||||
win_time: "Temps : ",
|
||||
win_next: "Niveau suivant ➡️",
|
||||
instructions: "Reliez tous les chiffres dans l'ordre (1 ➔ 2 ➔ 3...) en passant par <strong>TOUTES les cases</strong> de la grille exactement une fois, sans croiser les murs rouges ! (Glissez ou cliquez)"
|
||||
},
|
||||
en: {
|
||||
cell_count: "Cells:",
|
||||
target: "Goal:",
|
||||
target_reach: "Reach ",
|
||||
target_cover: "Cover {n} remaining cell(s)",
|
||||
target_done: "Completed! 🎉",
|
||||
level_1: "Level 1 (5×5 Easy)",
|
||||
level_2: "Level 2 (5×5 Medium)",
|
||||
level_3: "Level 3 (6×6 Expert)",
|
||||
level_random: "Infinite Generator 🎲",
|
||||
btn_undo: "↩️ Undo",
|
||||
btn_restart: "🔄 Restart",
|
||||
btn_challenge: "🎲 New Challenge",
|
||||
win_title: "🎉 CONGRATULATIONS!",
|
||||
win_sub: "Grid completed successfully!",
|
||||
win_time: "Time: ",
|
||||
win_next: "Next Level ➡️",
|
||||
instructions: "Connect all numbers in order (1 ➔ 2 ➔ 3...) visiting <strong>EVERY grid cell</strong> exactly once, without crossing red walls! (Drag or click)"
|
||||
}
|
||||
};
|
||||
|
||||
let currentZipLang = 'fr';
|
||||
function applyZipLang(lang) {
|
||||
currentZipLang = (lang && (lang.startsWith('en') ? 'en' : 'fr')) || 'fr';
|
||||
const dict = I18N_ZIP[currentZipLang] || I18N_ZIP.fr;
|
||||
|
||||
const lc = document.getElementById('labelCellCount');
|
||||
const lt = document.getElementById('labelTarget');
|
||||
const o1 = document.getElementById('optLevel1');
|
||||
const o2 = document.getElementById('optLevel2');
|
||||
const o3 = document.getElementById('optLevel3');
|
||||
const or = document.getElementById('optLevelRandom');
|
||||
const bu = document.getElementById('btnZipUndo');
|
||||
const br = document.getElementById('btnZipRestart');
|
||||
const bc = document.getElementById('btnZipChallenge');
|
||||
const wt = document.getElementById('winTitle');
|
||||
const ws = document.getElementById('winSub');
|
||||
const wn = document.getElementById('winNextBtn');
|
||||
const zi = document.getElementById('zipInstructions');
|
||||
|
||||
if (lc) lc.textContent = dict.cell_count;
|
||||
if (lt) lt.textContent = dict.target;
|
||||
if (o1) o1.textContent = dict.level_1;
|
||||
if (o2) o2.textContent = dict.level_2;
|
||||
if (o3) o3.textContent = dict.level_3;
|
||||
if (or) or.textContent = dict.level_random;
|
||||
if (bu) bu.textContent = dict.btn_undo;
|
||||
if (br) br.textContent = dict.btn_restart;
|
||||
if (bc) bc.textContent = dict.btn_challenge;
|
||||
if (wt) wt.textContent = dict.win_title;
|
||||
if (ws) ws.textContent = dict.win_sub;
|
||||
if (wn) wn.textContent = dict.win_next;
|
||||
if (zi) zi.innerHTML = dict.instructions;
|
||||
|
||||
if (typeof updateProgressUI === 'function') updateProgressUI();
|
||||
}
|
||||
applyZipLang(urlParams.get('lang'));
|
||||
|
||||
window.addEventListener('message', e => {
|
||||
if (e.data && e.data.type === 'themeChange') {
|
||||
setTheme(e.data.theme, e.data.macosMode);
|
||||
}
|
||||
if (e.data && e.data.type === 'langChange') {
|
||||
applyZipLang(e.data.lang);
|
||||
}
|
||||
});
|
||||
|
||||
// Audio synthesizer
|
||||
@@ -606,12 +707,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
const dict = I18N_ZIP[currentZipLang] || I18N_ZIP.fr;
|
||||
if (nextExpected <= maxNumber) {
|
||||
document.getElementById('nextTargetNum').textContent = `Atteindre le ${nextExpected}`;
|
||||
document.getElementById('nextTargetNum').textContent = `${dict.target_reach}${nextExpected}`;
|
||||
} else if (count < total) {
|
||||
document.getElementById('nextTargetNum').textContent = `Couvrir les ${total - count} case(s) restante(s)`;
|
||||
document.getElementById('nextTargetNum').textContent = dict.target_cover.replace('{n}', total - count);
|
||||
} else {
|
||||
document.getElementById('nextTargetNum').textContent = `Terminé ! 🎉`;
|
||||
document.getElementById('nextTargetNum').textContent = dict.target_done;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,7 +899,8 @@
|
||||
// VICTORY!
|
||||
if (timerInterval) clearInterval(timerInterval);
|
||||
playBeep('win');
|
||||
document.getElementById('winTime').textContent = `Temps : ${document.getElementById('timerDisplay').textContent}`;
|
||||
const dict = I18N_ZIP[currentZipLang] || I18N_ZIP.fr;
|
||||
document.getElementById('winTime').textContent = `${dict.win_time}${document.getElementById('timerDisplay').textContent}`;
|
||||
document.getElementById('winOverlay').style.display = 'flex';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user