add togglePresentationMode_WASM: enable F1 key handling, refine CSS styles, and adjust asset scaling logic
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 1m41s
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 1m41s
This commit is contained in:
@@ -105,6 +105,32 @@ func (g *Game) setupJavaScriptBridge() {
|
||||
return nil
|
||||
})
|
||||
|
||||
// togglePresentationMode_WASM()
|
||||
togglePresFunc := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
||||
log.Println("⌨️ F1: Toggle Presentation Mode")
|
||||
// Simulate F1 key press in WASM
|
||||
if g.appState == StatePresentation {
|
||||
g.appState = StateMenu
|
||||
g.disconnectFromServer()
|
||||
// JS Callback to hide screen
|
||||
js.Global().Call("showMainMenu")
|
||||
} else {
|
||||
g.appState = StatePresentation
|
||||
g.presAssets = nil
|
||||
g.presQuoteTime = time.Now()
|
||||
g.gameMode = "coop"
|
||||
g.isHost = true
|
||||
g.roomID = "PRES" + generateRoomCode()
|
||||
g.playerName = "PRESENTATION"
|
||||
go g.connectAndStart()
|
||||
|
||||
joinURL := "https://escape-from-school.de/?room=" + g.roomID
|
||||
g.presQRCode = generateQRCode(joinURL)
|
||||
g.notifyPresentationStarted_Platform(g.roomID)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
// Im globalen Scope registrieren
|
||||
js.Global().Set("startGame", startGameFunc)
|
||||
js.Global().Set("requestLeaderboard", requestLeaderboardFunc)
|
||||
@@ -112,6 +138,7 @@ func (g *Game) setupJavaScriptBridge() {
|
||||
js.Global().Set("setSFXVolume", setSFXVolumeFunc)
|
||||
js.Global().Set("startGameFromLobby_WASM", startGameFromLobbyFunc)
|
||||
js.Global().Set("setTeamName_WASM", setTeamNameFunc)
|
||||
js.Global().Set("togglePresentationMode_WASM", togglePresFunc)
|
||||
|
||||
log.Println("✅ JavaScript Bridge registriert")
|
||||
log.Printf("🔍 window.startGame defined: %v", !js.Global().Get("startGame").IsUndefined())
|
||||
|
||||
Reference in New Issue
Block a user