feat(ui): add Lobby and Main Menu Body (#38)
Co-authored-by: LQ63 <lkhermann@web.de> Reviewed-on: #38 Co-authored-by: Janis <janis.e.20@gmx.de> Co-committed-by: Janis <janis.e.20@gmx.de>
This commit is contained in:
@@ -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,14 @@ class GameLobby private(
|
||||
getPlayerBySession(getUserSession(user.id))
|
||||
}
|
||||
|
||||
def getPlayers: mutable.Map[UUID, UserSession] = {
|
||||
users.clone()
|
||||
}
|
||||
|
||||
def getLogic: GameLogic = {
|
||||
logic
|
||||
}
|
||||
|
||||
private def getPlayerBySession(userSession: UserSession): AbstractPlayer = {
|
||||
val playerOption = getMatch.totalplayers.find(_.id == userSession.id)
|
||||
if (playerOption.isEmpty) {
|
||||
|
||||
@@ -22,6 +22,12 @@ class StubUserManager @Inject()(val config: Config) extends UserManager {
|
||||
id = java.util.UUID.fromString("223e4567-e89b-12d3-a456-426614174000"),
|
||||
name = "Leon",
|
||||
passwordHash = UserHash.hashPW("password123")
|
||||
),
|
||||
"Jakob" -> User(
|
||||
internalId = 2L,
|
||||
id = java.util.UUID.fromString("323e4567-e89b-12d3-a456-426614174000"),
|
||||
name = "Jakob",
|
||||
passwordHash = UserHash.hashPW("password123")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user