refactor: decouple game networking from lobby client

* Replace direct client/server networking references with GameClient/GameServer scenes
* Refactor message bus to support local emission and argument expansion
* Move lobby connection lifecycle handling to message bus events
* Remove multiplayer connection wait helpers and direct lobby client coupling
* Rename Server to ServerNetworking and update lobby client references
* Update scene resources and export configuration
This commit is contained in:
2026-08-09 18:41:18 -05:00
parent 50439bc8e0
commit 93a2be399c
20 changed files with 174 additions and 77 deletions

View File

@@ -2,17 +2,18 @@ class_name Lobby extends LobbyBase
func _ready() -> void:
Globals.lobby_data.lobby_ui = self
setup_signals()
func _exit_tree() -> void:
# TODO: Maybe no longer needed...
if Globals.multiplayer_data.is_multiplayer_active: return
client._do_wait_close_connection()
if client.peer:
client.close_connection()
func setup_signals() -> void:
MessageBus.subscribe("lobby_wait_for_connection", client._do_wait_for_connection)
MessageBus.subscribe("lobby_close_connection", client._do_wait_close_connection)
MessageBus.subscribe("receive_match_list", _on_receive_match_list)
MessageBus.subscribe("match_list_activate_entry", _on_match_list_entry_activated)
MessageBus.subscribe("match_list_add_entry", _on_match_list_entry_added)
@@ -23,7 +24,7 @@ func setup_signals() -> void:
func _server_host_started() -> void:
host_connect_bttn.visible = false
# NOTE: 'matches_list' can be empty but so long as we get the call from the
# NOTE: 'matches_list' can be empty; so long as we get the call from the
# server we know we are connected and thus hide respective UI elements.
func _on_receive_match_list(matches_list: Array) -> void:
push_warning("Client Joined Host: Full Match List Recieved...\n", matches_list)
@@ -36,6 +37,8 @@ func _on_receive_match_list(matches_list: Array) -> void:
for match_entry in matches_list:
_create_match_entry(match_entry)
client.lobby_fully_connected = true
func _on_match_list_entry_activated(match_id: String) -> void:
for match_entry in match_list.get_children():
match_entry.join_bttn.visible = false