server: added broadcast for players entering the lobby. client: added text output for connection actions
This commit is contained in:
@@ -22,6 +22,8 @@ signal disconnected_from_server()
|
||||
signal connected_to_lobby(lobby_id: String)
|
||||
signal disconnected_from_lobby()
|
||||
|
||||
signal client_joined_lobby(client_name: String)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
_tcp.poll()
|
||||
_new_status = _tcp.get_status()
|
||||
@@ -60,6 +62,8 @@ func _handle_response(response: String) -> void:
|
||||
"join_lobby":
|
||||
if data["status"] == "ok":
|
||||
connected_to_lobby.emit.call_deferred(_lobby_id)
|
||||
"client_joined_lobby":
|
||||
client_joined_lobby.emit.call_deferred(data["new_client_name"])
|
||||
|
||||
func _exit_tree() -> void:
|
||||
disconnect_from_server()
|
||||
@@ -96,6 +100,8 @@ func leave_lobby() -> void:
|
||||
_lobby_id = ""
|
||||
_client_id = ""
|
||||
_client_name = ""
|
||||
|
||||
disconnected_from_lobby.emit()
|
||||
|
||||
func _send_message(message: String) -> void:
|
||||
_tcp.put_data(message.to_utf8_buffer())
|
||||
|
||||
Reference in New Issue
Block a user