From fd2467a9ea22dca64d5152a5a3e6db86d9a6f345 Mon Sep 17 00:00:00 2001 From: Janis Date: Mon, 1 Dec 2025 20:04:17 +0100 Subject: [PATCH] feat(api): BAC-11 Websocket - Return to Lobby (#94) Reviewed-on: https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/pulls/94 Co-authored-by: Janis Co-committed-by: Janis --- knockoutwhistweb/app/model/sessions/UserSession.scala | 2 ++ knockoutwhistweb/app/views/ingame/finishedMatch.scala.html | 2 +- knockoutwhistweb/public/javascripts/interact.js | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/knockoutwhistweb/app/model/sessions/UserSession.scala b/knockoutwhistweb/app/model/sessions/UserSession.scala index 64776fc..7e295e7 100644 --- a/knockoutwhistweb/app/model/sessions/UserSession.scala +++ b/knockoutwhistweb/app/model/sessions/UserSession.scala @@ -73,6 +73,8 @@ class UserSession(val user: User, val host: Boolean, val gameLobby: GameLobby) e case None => println("Player ID not found or is not a valid UUID.") } + case "ReturnToLobby" => + gameLobby.returnToLobby(this) } } lock.unlock() diff --git a/knockoutwhistweb/app/views/ingame/finishedMatch.scala.html b/knockoutwhistweb/app/views/ingame/finishedMatch.scala.html index 85fc7cf..bbb7f5b 100644 --- a/knockoutwhistweb/app/views/ingame/finishedMatch.scala.html +++ b/knockoutwhistweb/app/views/ingame/finishedMatch.scala.html @@ -10,7 +10,7 @@
@if((gamelobby.getUserSession(user.get.id).host)) {
-
Return to lobby
+
Return to lobby
} else {
diff --git a/knockoutwhistweb/public/javascripts/interact.js b/knockoutwhistweb/public/javascripts/interact.js index f035832..59cdc4c 100644 --- a/knockoutwhistweb/public/javascripts/interact.js +++ b/knockoutwhistweb/public/javascripts/interact.js @@ -77,3 +77,6 @@ function handleKickPlayer(playerId) { playerId: playerId }) } +function handleReturnToLobby() { + sendEvent("ReturnToLobby") +} \ No newline at end of file