server: added broadcast for players entering the lobby. client: added text output for connection actions

This commit is contained in:
2025-06-30 22:07:43 +02:00
parent 07a37a5602
commit d128f39e6a
4 changed files with 31 additions and 3 deletions
+13 -2
View File
@@ -11,6 +11,11 @@ extends Control
@export var name_input: LineEdit
@export var lobby_code_input: LineEdit
@export var output: Label
func _write_line(text: String) -> void:
output.text += text + "\n"
func _on_create_lobby_button_pressed() -> void:
client.create_lobby(name_input.text.strip_edges())
@@ -55,9 +60,15 @@ func _on_web_client_tcp_disconnected_from_server() -> void:
lobby_code_input.editable = false
lobby_code_input.text = ""
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}))
func _on_web_client_tcp_disconnected_from_lobby() -> void:
pass # Replace with function body.
_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({
"client_name": client_name,
"you": " (that's you!)" if client_name == name_input.text.strip_edges() else ""
}))