Private
Public Access
1
0

add presentation mode: implement presentation logic, QR code support, animated quotes, assets display, and emotes
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 1m33s

This commit is contained in:
Sebastian Unterschütz
2026-04-22 20:00:48 +02:00
parent 568ce516e7
commit e71fd6f0ee
8 changed files with 382 additions and 3 deletions

View File

@@ -184,6 +184,7 @@ type Game struct {
presQuoteTime time.Time
presAssets []presAssetInstance
lastPresUpdate time.Time
presQRCode *ebiten.Image
// Kamera
camX float64
@@ -281,10 +282,24 @@ func (g *Game) Update() error {
if inpututil.IsKeyJustPressed(ebiten.KeyF1) {
if g.appState == StatePresentation {
g.appState = StateMenu
g.disconnectFromServer()
} else {
g.appState = StatePresentation
g.presAssets = nil // Reset assets
g.presQuoteTime = time.Now() // Force immediate first quote
// Setup Server Connection for Presentation Mode
g.gameMode = "coop" // Use coop logic on server
g.isHost = true
g.roomID = "PRES" + generateRoomCode()
g.playerName = "PRESENTATION"
// Start connection process in background
go g.connectAndStart()
// Generate QR Code URL
joinURL := "https://escape-from-school.de/?room=" + g.roomID
g.presQRCode = generateQRCode(joinURL)
}
}
@@ -316,8 +331,8 @@ func (g *Game) Update() error {
}
}
// COUNTDOWN/RUNNING-Übergang: AppState auf StateGame setzen + JS benachrichtigen
if (currentStatus == "COUNTDOWN" || currentStatus == "RUNNING") && g.appState != StateGame {
// COUNTDOWN/RUNNING/PRESENTATION-Übergang: AppState auf StateGame setzen + JS benachrichtigen
if (currentStatus == "COUNTDOWN" || currentStatus == "RUNNING" || currentStatus == "PRESENTATION") && g.appState != StateGame && g.appState != StatePresentation {
log.Printf("🎮 Spiel startet! Status: %s -> %s", g.lastStatus, currentStatus)
g.appState = StateGame
g.notifyGameStarted()