fix(api): fixes - reimplemented animations (#90)

Reviewed-on: #90
This commit is contained in:
2025-11-27 09:52:00 +01:00
parent 1f96290371
commit cfcd967ce0
6 changed files with 76 additions and 51 deletions

View File

@@ -41,21 +41,21 @@ class UserSession(val user: User, val host: Boolean, val gameLobby: GameLobby) e
lock.lock()
val result = Try {
eventType match {
case "Ping" =>
case "ping" =>
// No action needed for Ping
()
case "Start Game" =>
case "StartGame" =>
gameLobby.startGame(user)
case "play Card" =>
val maybeCardIndex: Option[Int] = (data \ "cardindex").asOpt[Int]
case "PlayCard" =>
val maybeCardIndex: Option[String] = (data \ "cardindex").asOpt[String]
maybeCardIndex match {
case Some(index) =>
val session = gameLobby.getUserSession(user.id)
gameLobby.playCard(session, index)
gameLobby.playCard(session, index.toInt)
case None =>
println("Card Index not found or is not a number.")
}
case "Picked Trumpsuit" =>
case "PickTrumpsuit" =>
val maybeSuitIndex: Option[Int] = (data \ "suitIndex").asOpt[Int]
maybeSuitIndex match {
case Some(index) =>