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:
@@ -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 {
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user