Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce0203 committed Aug 4, 2023
1 parent fedcb74 commit 7ec6f78
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/src/commonMain/kotlin/ui/MainMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ suspend fun MainMenuState.mainMenu() {
customUiButton(size = bottomButtonSize).bottomButton("방 생성").onClick {
val room = createRoom()
serverList.removeFromParent()
joinRoom(room.uuid)
waitingRoom(room.uuid)
}
customUiButton(size = bottomButtonSize).bottomButton("새로고침").onClick {
Expand Down
4 changes: 4 additions & 0 deletions server/src/main/kotlin/application/rooms.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ fun Application.configureRooms() {
call.respond(HttpStatusCode.OK)
}
post("name") { call.respond(nameRoom(call.receive<UUID>())) }
post("leave") {

call.respond(HttpStatusCode.OK)
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions server/src/main/kotlin/model/Rooms.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ fun nameRoom(room: UUID) = transaction {

fun joinRoom(player: UUID, room: UUID) = transaction {
Player.find(Players.id eq player).first().room = EntityID(room, Rooms)
}

fun leaveRoom(session: UUID) = transaction {
getPlayerBySession(session).room = null
}

0 comments on commit 7ec6f78

Please sign in to comment.