feat(ui): Tie selection

Added a minimal ui for the tie selection. Tie selection gets sent to the server via websocket and gets response from it.
This commit is contained in:
LQ63
2026-01-13 14:24:51 +01:00
parent 4a4e9c48fc
commit ee7555ad97
3 changed files with 15 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ class UserSession(val user: User, val host: Boolean, val gameLobby: GameLobby) e
case _ =>
}
websocketActor.foreach(_.solveRequests())
println("EVENT which will get transmitted to client:" + event.id)
websocketActor.foreach(_.transmitEventToClient(event))
}
@@ -73,6 +74,15 @@ class UserSession(val user: User, val host: Boolean, val gameLobby: GameLobby) e
case None =>
println("Card Index not found or is not a number.")
}
case "PickTie" =>
val maybeCardIndex: Option[Int] = (data \ "cardIndex").asOpt[Int]
maybeCardIndex match {
case Some(index) =>
val session = gameLobby.getUserSession(user.id)
gameLobby.selectTie(session, index)
case None =>
println("Card Index not found or is not a number.")
}
case "KickPlayer" =>
val maybePlayerId: Option[String] = (data \ "playerId").asOpt[String]
maybePlayerId match {

View File

@@ -111,6 +111,7 @@ class UserWebsocketActor(
}
def transmitEventToClient(event: SimpleEvent): Unit = {
println("This event is getting transmitted to client (INSIDE transmitEventToClient")
transmitJsonToClient(WebsocketEventMapper.toJson(event, session))
}