feat(ui): add Lobby and Main Menu Body

Added main Menu body and a Lobby with Bootstrap
This commit is contained in:
LQ63
2025-11-04 19:11:19 +01:00
parent 44c88c8f60
commit 89d1626bb2
7 changed files with 154 additions and 17 deletions

View File

@@ -88,12 +88,12 @@ class GameLobby private(
* Remove the user from the game lobby.
* @param user the user who wants to leave the game.
*/
def leaveGame(user: User): Unit = {
val sessionOpt = users.get(user.id)
def leaveGame(userId: UUID): Unit = {
val sessionOpt = users.get(userId)
if (sessionOpt.isEmpty) {
throw new NotInThisGameException("You are not in this game!")
}
users.remove(user.id)
users.remove(userId)
}
/**
@@ -176,6 +176,10 @@ class GameLobby private(
getPlayerBySession(getUserSession(user.id))
}
def getPlayers: mutable.Map[UUID, UserSession] = {
users.clone()
}
private def getPlayerBySession(userSession: UserSession): AbstractPlayer = {
val playerOption = getMatch.totalplayers.find(_.id == userSession.id)
if (playerOption.isEmpty) {
@@ -225,7 +229,7 @@ class GameLobby private(
}
trickOpt.get
}
}
object GameLobby {