Private
Public Access
Implement HTML-based lobby system with player list management, host controls, and real-time updates. Add JavaScript-WASM communication for lobby state changes and game start triggers.
This commit is contained in:
1 parent
3232ee7c2f
commit
41d15c60d3
7 files changed
+209
-26
No files matched your search
@@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// In WASM: Menü und Leaderboard werden in HTML angezeigt
|
// In WASM: Menü, Lobby und Leaderboard werden in HTML angezeigt
|
||||||
// Lobby wird aber normal gezeichnet (für Co-op Warteraum)
|
// Canvas zeigt nur das eigentliche Spiel
|
||||||
|
|
||||||
func (g *Game) drawMenu(screen *ebiten.Image) {
|
func (g *Game) drawMenu(screen *ebiten.Image) {
|
||||||
// Schwarzer Hintergrund - HTML-Menü ist darüber
|
// Schwarzer Hintergrund - HTML-Menü ist darüber
|
||||||
@@ -18,8 +18,8 @@ func (g *Game) drawMenu(screen *ebiten.Image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) drawLobby(screen *ebiten.Image) {
|
func (g *Game) drawLobby(screen *ebiten.Image) {
|
||||||
// Lobby wird normal gezeichnet (für Co-op Warteraum)
|
// Schwarzer Hintergrund - HTML-Lobby ist darüber
|
||||||
g.DrawLobby(screen)
|
screen.Fill(color.RGBA{0, 0, 0, 255})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) drawLeaderboard(screen *ebiten.Image) {
|
func (g *Game) drawLeaderboard(screen *ebiten.Image) {
|
||||||
|
|||||||
@@ -355,6 +355,16 @@ func (g *Game) updateLobby() {
|
|||||||
g.gameState = game.GameState{Players: make(map[string]game.PlayerState)}
|
g.gameState = game.GameState{Players: make(map[string]game.PlayerState)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lobby State Change Detection (für HTML-Updates)
|
||||||
|
g.stateMutex.Lock()
|
||||||
|
currentPlayerCount := len(g.gameState.Players)
|
||||||
|
g.stateMutex.Unlock()
|
||||||
|
|
||||||
|
if currentPlayerCount != g.lastPlayerCount {
|
||||||
|
g.lastPlayerCount = currentPlayerCount
|
||||||
|
g.sendLobbyUpdateToJS()
|
||||||
|
}
|
||||||
|
|
||||||
// Spiel wurde gestartet?
|
// Spiel wurde gestartet?
|
||||||
if g.gameState.Status == "COUNTDOWN" || g.gameState.Status == "RUNNING" {
|
if g.gameState.Status == "COUNTDOWN" || g.gameState.Status == "RUNNING" {
|
||||||
g.appState = StateGame
|
g.appState = StateGame
|
||||||
|
|||||||
@@ -80,11 +80,19 @@ func (g *Game) setupJavaScriptBridge() {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// startGameFromLobby_WASM() - Host startet Spiel aus HTML Lobby
|
||||||
|
startGameFromLobbyFunc := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
||||||
|
log.Println("🎮 Host startet Spiel aus HTML Lobby")
|
||||||
|
go g.sendStartRequest()
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
// Im globalen Scope registrieren
|
// Im globalen Scope registrieren
|
||||||
js.Global().Set("startGame", startGameFunc)
|
js.Global().Set("startGame", startGameFunc)
|
||||||
js.Global().Set("requestLeaderboard", requestLeaderboardFunc)
|
js.Global().Set("requestLeaderboard", requestLeaderboardFunc)
|
||||||
js.Global().Set("setMusicVolume", setMusicVolumeFunc)
|
js.Global().Set("setMusicVolume", setMusicVolumeFunc)
|
||||||
js.Global().Set("setSFXVolume", setSFXVolumeFunc)
|
js.Global().Set("setSFXVolume", setSFXVolumeFunc)
|
||||||
|
js.Global().Set("startGameFromLobby_WASM", startGameFromLobbyFunc)
|
||||||
|
|
||||||
log.Println("✅ JavaScript Bridge registriert")
|
log.Println("✅ JavaScript Bridge registriert")
|
||||||
}
|
}
|
||||||
@@ -117,3 +125,30 @@ func (g *Game) sendGameOverToJS(score int) {
|
|||||||
log.Printf("💀 Game Over an JavaScript gesendet: Score=%d", score)
|
log.Printf("💀 Game Over an JavaScript gesendet: Score=%d", score)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lobby Player List an JavaScript senden
|
||||||
|
func (g *Game) sendLobbyPlayersToJS() {
|
||||||
|
g.stateMutex.Lock()
|
||||||
|
players := make([]interface{}, 0, len(g.gameState.Players))
|
||||||
|
hostID := g.gameState.HostID
|
||||||
|
|
||||||
|
for id, p := range g.gameState.Players {
|
||||||
|
name := p.Name
|
||||||
|
if name == "" {
|
||||||
|
name = id
|
||||||
|
}
|
||||||
|
isHost := (id == hostID)
|
||||||
|
players = append(players, map[string]interface{}{
|
||||||
|
"name": name,
|
||||||
|
"is_host": isHost,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
g.stateMutex.Unlock()
|
||||||
|
|
||||||
|
// JavaScript-Funktion aufrufen
|
||||||
|
if updateFunc := js.Global().Get("updateLobbyPlayers"); !updateFunc.IsUndefined() {
|
||||||
|
jsPlayers := js.ValueOf(players)
|
||||||
|
updateFunc.Invoke(jsPlayers)
|
||||||
|
log.Printf("👥 Lobby-Spieler an JavaScript gesendet: %d Spieler", len(players))
|
||||||
|
}
|
||||||
|
}
|
||||||
+69
-20
@@ -91,10 +91,17 @@ function startSoloGame() {
|
|||||||
localStorage.setItem('escape_game_mode', 'solo');
|
localStorage.setItem('escape_game_mode', 'solo');
|
||||||
localStorage.setItem('escape_room_id', '');
|
localStorage.setItem('escape_room_id', '');
|
||||||
|
|
||||||
// Hide menu and show canvas
|
// Hide ALL screens including main menu
|
||||||
hideAllScreens();
|
hideAllScreens();
|
||||||
|
document.getElementById('menu').style.display = 'none';
|
||||||
gameStarted = true;
|
gameStarted = true;
|
||||||
|
|
||||||
|
// Canvas sichtbar machen
|
||||||
|
const canvas = document.querySelector('canvas');
|
||||||
|
if (canvas) {
|
||||||
|
canvas.classList.add('game-active');
|
||||||
|
}
|
||||||
|
|
||||||
// Trigger WASM game start
|
// Trigger WASM game start
|
||||||
if (window.startGame) {
|
if (window.startGame) {
|
||||||
window.startGame('solo', playerName, '');
|
window.startGame('solo', playerName, '');
|
||||||
@@ -120,17 +127,17 @@ function createRoom() {
|
|||||||
localStorage.setItem('escape_team_name', teamName);
|
localStorage.setItem('escape_team_name', teamName);
|
||||||
localStorage.setItem('escape_is_host', 'true');
|
localStorage.setItem('escape_is_host', 'true');
|
||||||
|
|
||||||
// Hide menu and show canvas (Lobby wird vom WASM gezeichnet)
|
// Verstecke ALLE Screens inkl. Hauptmenü
|
||||||
hideAllScreens();
|
hideAllScreens();
|
||||||
gameStarted = true;
|
document.getElementById('menu').style.display = 'none';
|
||||||
|
|
||||||
// Canvas sichtbar machen für Lobby
|
// Zeige HTML Lobby Screen
|
||||||
const canvas = document.querySelector('canvas');
|
document.getElementById('lobbyScreen').classList.remove('hidden');
|
||||||
if (canvas) {
|
document.getElementById('lobbyRoomCode').textContent = roomID;
|
||||||
canvas.classList.add('game-active');
|
document.getElementById('lobbyHostControls').classList.remove('hidden');
|
||||||
}
|
document.getElementById('lobbyStatus').textContent = 'Du bist Host - starte wenn bereit!';
|
||||||
|
|
||||||
// Trigger WASM game start
|
// Trigger WASM game start (im Hintergrund)
|
||||||
if (window.startGame) {
|
if (window.startGame) {
|
||||||
window.startGame('coop', playerName, roomID, teamName, true);
|
window.startGame('coop', playerName, roomID, teamName, true);
|
||||||
}
|
}
|
||||||
@@ -160,17 +167,17 @@ function joinRoom() {
|
|||||||
localStorage.setItem('escape_team_name', teamName);
|
localStorage.setItem('escape_team_name', teamName);
|
||||||
localStorage.setItem('escape_is_host', 'false');
|
localStorage.setItem('escape_is_host', 'false');
|
||||||
|
|
||||||
// Hide menu and show canvas
|
// Verstecke ALLE Screens inkl. Hauptmenü
|
||||||
hideAllScreens();
|
hideAllScreens();
|
||||||
gameStarted = true;
|
document.getElementById('menu').style.display = 'none';
|
||||||
|
|
||||||
// Canvas sichtbar machen für Lobby
|
// Zeige HTML Lobby Screen
|
||||||
const canvas = document.querySelector('canvas');
|
document.getElementById('lobbyScreen').classList.remove('hidden');
|
||||||
if (canvas) {
|
document.getElementById('lobbyRoomCode').textContent = roomID;
|
||||||
canvas.classList.add('game-active');
|
document.getElementById('lobbyHostControls').classList.add('hidden');
|
||||||
}
|
document.getElementById('lobbyStatus').textContent = 'Warte auf Host...';
|
||||||
|
|
||||||
// Trigger WASM game start
|
// Trigger WASM game start (im Hintergrund)
|
||||||
if (window.startGame) {
|
if (window.startGame) {
|
||||||
window.startGame('coop', playerName, roomID, teamName, false);
|
window.startGame('coop', playerName, roomID, teamName, false);
|
||||||
}
|
}
|
||||||
@@ -178,6 +185,47 @@ function joinRoom() {
|
|||||||
console.log('🎮 Joining room:', roomID);
|
console.log('🎮 Joining room:', roomID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lobby Functions
|
||||||
|
function startGameFromLobby() {
|
||||||
|
// Host startet das Spiel
|
||||||
|
hideAllScreens();
|
||||||
|
document.getElementById('menu').style.display = 'none';
|
||||||
|
gameStarted = true;
|
||||||
|
|
||||||
|
// Canvas sichtbar machen
|
||||||
|
const canvas = document.querySelector('canvas');
|
||||||
|
if (canvas) {
|
||||||
|
canvas.classList.add('game-active');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signal an WASM senden dass Spiel starten soll
|
||||||
|
if (window.startGameFromLobby_WASM) {
|
||||||
|
window.startGameFromLobby_WASM();
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('🎮 Host started game from lobby');
|
||||||
|
}
|
||||||
|
|
||||||
|
function leaveLobby() {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update Lobby Player List (called by WASM)
|
||||||
|
function updateLobbyPlayers(players) {
|
||||||
|
const list = document.getElementById('lobbyPlayerList');
|
||||||
|
if (!players || players.length === 0) {
|
||||||
|
list.innerHTML = '<div style="color: #888;">Warte auf Spieler...</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.innerHTML = players.map((player, index) => {
|
||||||
|
const hostBadge = player.is_host ? ' <span style="color:#ffcc00;">[HOST]</span>' : '';
|
||||||
|
return `<div style="padding:5px 0; color:#fff;">• ${player.name}${hostBadge}</div>`;
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
console.log('👥 Lobby players updated:', players.length);
|
||||||
|
}
|
||||||
|
|
||||||
function loadLeaderboard() {
|
function loadLeaderboard() {
|
||||||
const list = document.getElementById('leaderboardList');
|
const list = document.getElementById('leaderboardList');
|
||||||
list.innerHTML = '<div style="text-align:center; padding:20px;">Lädt Leaderboard...</div>';
|
list.innerHTML = '<div style="text-align:center; padding:20px;">Lädt Leaderboard...</div>';
|
||||||
@@ -197,16 +245,16 @@ function loadLeaderboard() {
|
|||||||
|
|
||||||
// Called by WASM to update leaderboard
|
// Called by WASM to update leaderboard
|
||||||
function updateLeaderboard(entries) {
|
function updateLeaderboard(entries) {
|
||||||
// Update main leaderboard page
|
// Update ALL leaderboard displays
|
||||||
const list = document.getElementById('leaderboardList');
|
const list = document.getElementById('leaderboardList');
|
||||||
|
|
||||||
// Update start screen leaderboard
|
|
||||||
const startList = document.getElementById('startLeaderboardList');
|
const startList = document.getElementById('startLeaderboardList');
|
||||||
|
const gameOverList = document.getElementById('gameOverLeaderboardList');
|
||||||
|
|
||||||
if (!entries || entries.length === 0) {
|
if (!entries || entries.length === 0) {
|
||||||
const emptyMsg = '<div style="text-align:center; padding:20px; color:#888;">Noch keine Einträge</div>';
|
const emptyMsg = '<div style="text-align:center; padding:20px; color:#888;">Noch keine Einträge</div>';
|
||||||
if (list) list.innerHTML = emptyMsg;
|
if (list) list.innerHTML = emptyMsg;
|
||||||
if (startList) startList.innerHTML = emptyMsg;
|
if (startList) startList.innerHTML = emptyMsg;
|
||||||
|
if (gameOverList) gameOverList.innerHTML = emptyMsg;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,6 +271,7 @@ function updateLeaderboard(entries) {
|
|||||||
|
|
||||||
if (list) list.innerHTML = html;
|
if (list) list.innerHTML = html;
|
||||||
if (startList) startList.innerHTML = html;
|
if (startList) startList.innerHTML = html;
|
||||||
|
if (gameOverList) gameOverList.innerHTML = html;
|
||||||
|
|
||||||
console.log('📊 Leaderboard updated with', entries.length, 'entries');
|
console.log('📊 Leaderboard updated with', entries.length, 'entries');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,19 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
||||||
<title>Escape From Teacher</title>
|
<title>Escape From Teacher</title>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<style>
|
||||||
|
/* DEBUG: Force menu visibility */
|
||||||
|
#menu {
|
||||||
|
position: fixed !important;
|
||||||
|
top: 0 !important;
|
||||||
|
left: 0 !important;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
background: rgba(0, 0, 0, 0.95) !important;
|
||||||
|
z-index: 10000 !important;
|
||||||
|
display: flex !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -115,6 +128,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- LOBBY SCREEN (CO-OP WAITING ROOM) -->
|
||||||
|
<div id="lobbyScreen" class="overlay-screen hidden">
|
||||||
|
<div class="center-box">
|
||||||
|
<h1>LOBBY</h1>
|
||||||
|
|
||||||
|
<div style="margin: 20px 0;">
|
||||||
|
<p style="font-size: 14px; color: #aaa;">Raum-Code:</p>
|
||||||
|
<div style="background: rgba(0,0,0,0.6); border: 4px solid #ffcc00; padding: 20px; font-size: 32px; color: #ffcc00; letter-spacing: 4px;">
|
||||||
|
<span id="lobbyRoomCode">XXXXX</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin: 20px 0; width: 100%; max-width: 400px;">
|
||||||
|
<p style="font-size: 14px; color: #aaa; margin-bottom: 10px;">Spieler im Raum:</p>
|
||||||
|
<div id="lobbyPlayerList" style="background: rgba(0,0,0,0.5); border: 2px solid #666; padding: 15px; min-height: 100px; font-family: sans-serif; font-size: 14px;">
|
||||||
|
<div style="color: #888;">Warte auf Spieler...</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="lobbyHostControls" class="hidden" style="margin: 20px 0;">
|
||||||
|
<button class="big-btn" onclick="startGameFromLobby()" style="background: #00cc00;">SPIEL STARTEN</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p id="lobbyStatus" style="font-size: 12px; color: #ffcc00; margin: 20px 0;">Warte auf Host...</p>
|
||||||
|
|
||||||
|
<button class="back-btn" onclick="leaveLobby()">← LOBBY VERLASSEN</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- GAME OVER SCREEN -->
|
<!-- GAME OVER SCREEN -->
|
||||||
<div id="gameOverScreen" class="overlay-screen hidden">
|
<div id="gameOverScreen" class="overlay-screen hidden">
|
||||||
<div class="center-box">
|
<div class="center-box">
|
||||||
@@ -124,7 +166,7 @@
|
|||||||
Dein Score: <span id="finalScore" style="color:yellow; font-size: 24px;">0</span>
|
Dein Score: <span id="finalScore" style="color:yellow; font-size: 24px;">0</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div id="leaderboardList" class="leaderboard-box" style="margin: 20px 0;">
|
<div id="gameOverLeaderboardList" class="leaderboard-box" style="margin: 20px 0;">
|
||||||
Lade Leaderboard...
|
Lade Leaderboard...
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1,48 @@
|
|||||||
/* ========================================= LOKALE SCHRIFTARTEN (DSGVO Konform) ========================================= */@font-face{font-display:swap;font-family:'Press Start 2P';font-style:normal;font-weight:400;src:url('../assets/fonts/press-start-2p-v16-latin-regular.woff2') format('woff2')}body,html{margin:0;padding:0;width:100%;height:100%;background-color:#1a1a1a;color:#fff;overflow:hidden;display:flex;justify-content:center;align-items:center;font-family:'Press Start 2P',cursive;font-size:14px}#game-container{position:relative;width:100%;height:100%;box-shadow:0 0 50px rgba(0,0,0,.8);border:4px solid #444;background:#000;display:flex;overflow:hidden}canvas{position:fixed!important;top:0!important;left:0!important;width:100%!important;height:100%!important;z-index:1!important;background:#000;image-rendering:pixelated;image-rendering:crisp-edges;opacity:0;pointer-events:none;transition:opacity .3s}canvas.game-active{opacity:1;pointer-events:auto}.overlay-screen{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.95);display:flex;justify-content:center;align-items:center;z-index:1000;box-sizing:border-box;padding:20px}.overlay-screen.hidden{display:none!important}#startScreen{display:flex;flex-direction:row;gap:40px;width:100%;height:100%;align-items:center;justify-content:center}.start-left{flex:2;display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:60%}.start-right{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:35%}.center-box{display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:600px;width:100%}h1{font-size:32px;color:#f44;text-shadow:4px 4px 0 #000;line-height:1.4;margin:10px 0 25px;text-align:center;text-transform:uppercase}button{font-family:'Press Start 2P',cursive;background:#fc0;border:4px solid #fff;padding:18px 30px;font-size:18px;cursor:pointer;color:#000;box-shadow:0 6px 0 #997a00;text-transform:uppercase;margin:12px;transition:all .1s}button:hover{background:#ffd700}button:active{transform:translateY(4px);box-shadow:0 1px 0 #997a00}button:disabled{background:#555;color:#888;box-shadow:none;cursor:not-allowed}.big-btn{font-size:22px;padding:20px 40px}.back-btn{background:0 0;border:2px solid #666;color:#888;box-shadow:none;font-size:12px;padding:10px 20px;margin-top:30px}.back-btn:hover{background:#333;color:#fff;border-color:#fff}.legal-btn{font-size:10px;padding:8px 12px;margin:5px;background:0 0;border:1px solid #666;color:#888;box-shadow:none}.legal-btn:hover{background:#333;color:#fff;border-color:#fff}input[type=range],input[type=text]{font-family:'Press Start 2P',cursive;padding:12px;font-size:16px;border:3px solid #fff;background:#222;color:#fff;text-align:center;margin-bottom:15px;width:100%;max-width:350px;outline:0;box-sizing:border-box}input[type=text]::placeholder{color:#666}input[type=text]:focus{border-color:#fc0;box-shadow:0 0 10px rgba(255,204,0,.5)}.info-box{background:rgba(255,255,255,.1);border:2px solid #555;padding:12px;margin:8px 0;width:100%;max-width:320px;text-align:left;box-sizing:border-box}.info-box p{font-family:sans-serif;font-size:14px;color:#ccc;line-height:1.4;margin:0}.info-title{color:#fc0;font-size:12px;margin-bottom:6px;text-align:center;text-decoration:underline}.legal-bar{margin-top:20px;display:flex;gap:15px;flex-wrap:wrap;justify-content:center}.hall-of-fame-box{background:rgba(0,0,0,.6);border:4px solid #fc0;padding:15px;width:100%;max-height:300px;overflow-y:auto;box-shadow:0 0 15px rgba(255,204,0,.1)}.hall-of-fame-box h3{color:#fc0;text-align:center;margin-top:0;margin-bottom:10px;border-bottom:2px solid #555;padding-bottom:8px;font-size:14px}.leaderboard-box{background:rgba(0,0,0,.5);border:4px solid #666;padding:15px;width:100%;max-width:500px;max-height:400px;overflow-y:auto;font-family:sans-serif;color:#ddd}.hof-entry,.leaderboard-item{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px dotted #444;font-size:12px;font-family:sans-serif;color:#ddd;line-height:1.4}.hof-rank,.leaderboard-rank{color:#fc0;font-weight:700;margin-right:10px;min-width:40px}.hof-name,.leaderboard-name{flex:1}.hof-score,.leaderboard-score{color:#fff;font-weight:700}.settings-group{display:flex;flex-direction:column;gap:25px;width:100%;max-width:500px;margin:20px 0}.setting-item{display:flex;flex-direction:column;align-items:center;gap:10px}.setting-item label{color:#fc0;font-size:12px}.setting-item input[type=range]{width:100%;max-width:300px}.setting-item span{color:#fff;font-size:14px}.loading-screen{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.95);display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:9999}.spinner{border:8px solid #333;border-top:8px solid #fc0;border-radius:50%;width:60px;height:60px;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}#mute-btn{position:fixed;top:10px;leLine truncated
|
@font-face{font-display:swap;font-family:'Press Start 2P';font-style:normal;font-weight:400;src:url('../assets/fonts/press-start-2p-v16-latin-regular.woff2') format('woff2')}
|
||||||
|
body,html{margin:0;padding:0;width:100%;height:100%;background-color:#1a1a1a;color:#fff;overflow:hidden;font-family:'Press Start 2P',cursive;font-size:14px}
|
||||||
|
#game-container{position:relative;width:100%;height:100%;box-shadow:0 0 50px rgba(0,0,0,.8);border:4px solid #444;background:#000}
|
||||||
|
canvas{position:fixed!important;top:0!important;left:0!important;width:100%!important;height:100%!important;z-index:1!important;background:#000;image-rendering:pixelated;opacity:0;pointer-events:none;transition:opacity .3s}
|
||||||
|
canvas.game-active{opacity:1;pointer-events:auto;z-index:2000!important}
|
||||||
|
.overlay-screen{position:fixed!important;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.95);display:flex;justify-content:center;align-items:center;z-index:1000;box-sizing:border-box;padding:20px}
|
||||||
|
.overlay-screen.hidden{display:none!important}
|
||||||
|
#startScreen{display:flex;flex-direction:row;gap:40px;width:100%;height:100%;align-items:center;justify-content:center}
|
||||||
|
.start-left{flex:2;display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:60%}
|
||||||
|
.start-right{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:35%}
|
||||||
|
.center-box{display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:600px;width:100%}
|
||||||
|
h1{font-size:32px;color:#f44;text-shadow:4px 4px 0 #000;line-height:1.4;margin:10px 0 25px;text-align:center;text-transform:uppercase}
|
||||||
|
button{font-family:'Press Start 2P',cursive;background:#fc0;border:4px solid #fff;padding:18px 30px;font-size:18px;cursor:pointer;color:#000;box-shadow:0 6px 0 #997a00;text-transform:uppercase;margin:12px;transition:all .1s}
|
||||||
|
button:hover{background:#ffd700}
|
||||||
|
button:active{transform:translateY(4px);box-shadow:0 1px 0 #997a00}
|
||||||
|
.big-btn{font-size:22px;padding:20px 40px}
|
||||||
|
.back-btn{background:0 0;border:2px solid #666;color:#888;box-shadow:none;font-size:12px;padding:10px 20px;margin-top:30px}
|
||||||
|
.back-btn:hover{background:#333;color:#fff;border-color:#fff}
|
||||||
|
.legal-btn{font-size:10px;padding:8px 12px;margin:5px;background:0 0;border:1px solid #666;color:#888;box-shadow:none}
|
||||||
|
.legal-btn:hover{background:#333;color:#fff;border-color:#fff}
|
||||||
|
input[type=text]{font-family:'Press Start 2P',cursive;padding:12px;font-size:16px;border:3px solid #fff;background:#222;color:#fff;text-align:center;margin-bottom:15px;width:100%;max-width:350px;outline:0;box-sizing:border-box}
|
||||||
|
input[type=text]::placeholder{color:#666}
|
||||||
|
input[type=text]:focus{border-color:#fc0;box-shadow:0 0 10px rgba(255,204,0,.5)}
|
||||||
|
input[type=range]{width:100%;max-width:300px}
|
||||||
|
.info-box{background:rgba(255,255,255,.1);border:2px solid #555;padding:12px;margin:8px 0;width:100%;max-width:320px;text-align:left;box-sizing:border-box}
|
||||||
|
.info-box p{font-family:sans-serif;font-size:14px;color:#ccc;line-height:1.4;margin:0}
|
||||||
|
.info-title{color:#fc0;font-size:12px;margin-bottom:6px;text-align:center;text-decoration:underline}
|
||||||
|
.legal-bar{margin-top:20px;display:flex;gap:15px;flex-wrap:wrap;justify-content:center}
|
||||||
|
.hall-of-fame-box{background:rgba(0,0,0,.6);border:4px solid #fc0;padding:15px;width:100%;max-height:300px;overflow-y:auto;box-shadow:0 0 15px rgba(255,204,0,.1)}
|
||||||
|
.hall-of-fame-box h3{color:#fc0;text-align:center;margin-top:0;margin-bottom:10px;border-bottom:2px solid #555;padding-bottom:8px;font-size:14px}
|
||||||
|
.leaderboard-box{background:rgba(0,0,0,.5);border:4px solid #666;padding:15px;width:100%;max-width:500px;max-height:400px;overflow-y:auto;font-family:sans-serif;color:#ddd}
|
||||||
|
.leaderboard-item{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px dotted #444;font-size:12px;font-family:sans-serif;color:#ddd;line-height:1.4}
|
||||||
|
.leaderboard-rank{color:#fc0;font-weight:700;margin-right:10px;min-width:40px}
|
||||||
|
.leaderboard-name{flex:1}
|
||||||
|
.leaderboard-score{color:#fff;font-weight:700}
|
||||||
|
.settings-group{display:flex;flex-direction:column;gap:25px;width:100%;max-width:500px;margin:20px 0}
|
||||||
|
.setting-item{display:flex;flex-direction:column;align-items:center;gap:10px}
|
||||||
|
.setting-item label{color:#fc0;font-size:12px}
|
||||||
|
.setting-item span{color:#fff;font-size:14px}
|
||||||
|
.loading-screen{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.95);display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:9999}
|
||||||
|
.spinner{border:8px solid #333;border-top:8px solid #fc0;border-radius:50%;width:60px;height:60px;animation:spin 1s linear infinite}
|
||||||
|
@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
|
||||||
|
#mute-btn{position:fixed;top:10px;left:10px;z-index:10000;background:rgba(0,0,0,.5);border:2px solid #555;color:#fff;font-size:20px;width:40px;height:40px;border-radius:50%;cursor:pointer;padding:0;margin:0;display:flex;align-items:center;justify-content:center;box-shadow:0 0 10px rgba(0,0,0,.5)}
|
||||||
|
#mute-btn:hover{background:rgba(255,255,255,.2);border-color:#fff}
|
||||||
|
#rotate-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:#222;z-index:99999;color:#fff;flex-direction:column;align-items:center;justify-content:center;text-align:center}
|
||||||
|
.icon{font-size:60px;margin-bottom:20px}
|
||||||
|
@media screen and (orientation:portrait){#rotate-overlay{display:flex}#game-container{display:none!important}}
|
||||||
|
@media (min-width:1024px){h1{font-size:48px}button{font-size:22px;padding:20px 40px}input[type=text]{max-width:450px;font-size:20px;padding:15px}.info-box{max-width:500px}.hall-of-fame-box{max-height:400px}}
|
||||||
Reference in new issue
Block a user