client: now handles disconnects properly and notifies the user of server connect and disconnect

This commit is contained in:
2025-07-04 12:22:48 +02:00
parent 2aa6d710cf
commit b468a391f5
2 changed files with 29 additions and 12 deletions
+6 -2
View File
@@ -56,6 +56,8 @@ func _on_web_client_tcp_connected_to_server() -> void:
name_input.editable = true
lobby_code_input.editable = true
_write_line("You are connected to the server")
func _on_web_client_tcp_connection_error_occurred() -> void:
connect_button.disabled = false
@@ -68,13 +70,15 @@ func _on_web_client_tcp_disconnected_from_server() -> void:
name_input.editable = true
lobby_code_input.editable = false
lobby_code_input.text = ""
_write_line("You were disconnected from the server")
func _on_web_client_tcp_connected_to_lobby(lobby_id: String) -> void:
lobby_code_input.text = lobby_id
_write_line("you connected to lobby {lobby_id}".format({"lobby_id": lobby_id}))
_write_line("You connected to lobby {lobby_id}".format({"lobby_id": lobby_id}))
func _on_web_client_tcp_disconnected_from_lobby() -> void:
_write_line("you disconnected from the lobby")
_write_line("You disconnected from the lobby")
func _on_web_client_tcp_client_joined_lobby(client_name: String) -> void:
_write_line("{client_name} joined the lobby{you}".format({