Skip to content

Commit

Permalink
Release v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Foso committed Sep 26, 2021
1 parent dcfc0a9 commit 952dcf5
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 114 deletions.
11 changes: 10 additions & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
v1.3
==============================

* you can add your name as an url parameter with "uname", example:
http://shwdwn.herokuapp.com/#/room/Testroom?uname=MyName

* When the connection to server was lost, the client now automatically tries to reconnect

v1.1
========================================
* added password for rooms

* added password for rooms
* add auto reveal mode


2 changes: 1 addition & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
apply from: './constants.gradle'
}
buildscript {
ext.kotlin_version = '1.5.21'
ext.kotlin_version = '1.5.31'
ext.ktor_version = '1.6.3'

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ class ServerGame(private val server: GameServer, var gameConfig: ServerConfig) {

private fun sendBroadcast(json: String) {
playerList.forEach {
println("sendBroadcast: ${it.name} $json")
server.sendData(it.sessionId, json)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class ShowdownApplication {

get("room/{roomName}/{param...}") {
val roomName = call.parameters["roomName"]?.substringBeforeLast("?") ?: ""
println("ROOMM: $roomName")
if (!call.request.uri.endsWith("/")) {
call.respondRedirect("/room/$roomName/")
}
Expand All @@ -89,7 +88,7 @@ class ShowdownApplication {
val roomName = call.parameters["room"]?.substringBeforeLast("?") ?: ""
val password = call.parameters["pw"] ?: ""
val session = call.sessions.get<Session>()
println("Web $roomName")

// We check that we actually have a session. We should always have one,
// since we have defined an interceptor before to set one.
if (session == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class ShowdownServer : GameServer {
val socketList = members.computeIfAbsent(memberId) { CopyOnWriteArrayList<WebSocketSession>() }

socketList.add(socket)
println("JOINED: $memberId ${socketList.size}")

}

Expand Down Expand Up @@ -135,7 +134,6 @@ class ShowdownServer : GameServer {
?.let { joinGame ->
if (gameMap.none { it.key == room.name }) {
gameSource = createNewRoom(room.name)
println("Create new Room" + room.name)

}

Expand Down Expand Up @@ -184,7 +182,6 @@ class ShowdownServer : GameServer {
}

override fun closeRoom(roomName: String) {
println("Close Room $roomName")
gameMap.remove(roomName)
}

Expand All @@ -198,7 +195,6 @@ class ShowdownServer : GameServer {
}

suspend fun sendMessage(recipient: String, message: String) {
println("sendMessageToClient: $message")
members[recipient]?.send(Frame.Text(message))
}

Expand Down
88 changes: 2 additions & 86 deletions server/src/main/resources/web/web.js

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions web/src/main/kotlin/showdown.web/network/GameApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,17 @@ class GameApiClient {
private inline fun <reified T> decodeFromString(json: String): T? = try {
Json.decodeFromString<T>(json)
} catch (ex: Exception) {
println("TT" + ex + " " + json)
null
}

private fun onMessage(messageEvent: MessageEvent) {

val json = messageEvent.data.toString()
println("onMessage $json")
var response: Response? = null
try {
response = Json.decodeFromString<Response>(json)
} catch (ex: Exception) {
println("TT" + ex + " " + json)
println("onMessage" + ex + " " + json)
}

response?.let { it ->
Expand All @@ -84,12 +82,8 @@ class GameApiClient {

PATHS.MESSAGE -> {
observer.onMessageEvent(response.body)
// console.log("RESPONSE"+response.body)
}

PATHS.SETROOMPASSSWORDPATH, PATHS.EMPTY -> {
println("PATH: $path $json")
}
PATHS.ERROR -> {
decodeFromString<ShowdownError>(it.body)?.let {
observer.onError(it)
Expand All @@ -103,7 +97,7 @@ class GameApiClient {
}
}
else -> {
println("DOnt Care about $path")
// println("DOnt Care about $path")
}
}
}
Expand All @@ -112,7 +106,6 @@ class GameApiClient {
}

fun sendMessage(message: String) {
println("sendMessageToServer: " + message)
socket?.send(message)
}
}
2 changes: 0 additions & 2 deletions web/src/main/kotlin/showdown.web/ui/game/GameViewmodel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class GameViewmodel(
}
}
ShowdownError.NoConnectionError -> {
println("observeErrors")
connectToServer()
view.newState {
this.showConnectionError = true
Expand All @@ -87,7 +86,6 @@ class GameViewmodel(
wasConnected = true
},
onError = {
println("HIER: ${it.message}")

view.newState {
this.showConnectionError = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ class GameFieldComponent : RComponent<Props, GameFieldState>() {
override fun RBuilder.render() {

//OPTIONS
if (!state.isSpectator) {
optionsList(state.selectedOptionId, state.options, onOptionClicked = { index: Int ->
setState {
this.selectedOptionId = index
}
viewmodel.onSelectedVote(index)
})
}

optionsList(state.selectedOptionId, state.options, onOptionClicked = { index: Int ->
setState {
this.selectedOptionId = index
}
viewmodel.onSelectedVote(index)
})

spectatorCheckbox()


Expand Down

0 comments on commit 952dcf5

Please sign in to comment.