Files
KnockOutWhist-Web/knockoutwhistweb/app/views/lobby/lobby.scala.html
lq64 194df5691c feat: FRO-3 FRO-4 Added vue compontents to ingame and lobby (#100)
Added vue compontents to ingame and lobby.

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #100
Co-authored-by: lq64 <lq@blackhole.local>
Co-committed-by: lq64 <lq@blackhole.local>
2025-12-04 08:00:58 +01:00

38 lines
1.2 KiB
HTML

@(user: Option[model.users.User], gamelobby: logic.game.GameLobby)
@import play.api.libs.json._
<div id="lobby-app-mount"></div>
<script>
// Initialisierung des momentanen Lobby Standes, welcher direkt gerendert werden muss.
const initialLobbyName = '@gamelobby.name';
const initialLobbyId = '@gamelobby.id';
const initialIsHost = @{user.map(u => gamelobby.getUserSession(u.id)).exists(_.host)};
const initialMaxPlayers = @{gamelobby.maxPlayers};
const initialPlayers = JSON.parse('@Html({
val currentUserId = user.map(_.id).getOrElse(java.util.UUID.randomUUID())
val playerListForVue = gamelobby.getUsers.toSeq.map { u =>
val isSelf = u.id == currentUserId
val playerDogStatus = false
Json.obj(
"id" -> u.id.toString,
"name" -> u.name,
"self" -> isSelf,
"dog" -> playerDogStatus
)
}
Json.stringify(Json.toJson(playerListForVue))
})');
connectWebSocket();
globalThis.initLobbyVueComponents(
initialLobbyName,
initialLobbyId,
initialIsHost,
initialMaxPlayers,
initialPlayers
);
</script>