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:
@@ -17,8 +17,31 @@ func start_client(address: String = "127.0.0.1", port: int = 8080) -> void:
|
||||
multiplayer.server_disconnected.connect(client_disconnected_from_server)
|
||||
multiplayer.connection_failed.connect(client_connection_failed_to_server)
|
||||
|
||||
|
||||
func _wait_for_connection() -> void:
|
||||
while not peer:
|
||||
await get_tree().process_frame
|
||||
|
||||
while peer.get_connection_status() != 2:
|
||||
await get_tree().process_frame
|
||||
|
||||
func _wait_close_connection():
|
||||
close_connection()
|
||||
|
||||
while peer:
|
||||
await get_tree().process_frame
|
||||
|
||||
|
||||
func client_connected_to_server() -> void:
|
||||
push_warning("Connected to server!")
|
||||
assert(false, "This method needs to be overridden...")
|
||||
|
||||
func client_disconnected_from_server() -> void:
|
||||
assert(false, "This method needs to be overridden...")
|
||||
|
||||
|
||||
func client_connection_failed_to_server() -> void:
|
||||
assert(false, "This method needs to be overridden...")
|
||||
|
||||
|
||||
func close_connection() -> void:
|
||||
if not peer: return
|
||||
@@ -27,13 +50,6 @@ func close_connection() -> void:
|
||||
|
||||
unset_client()
|
||||
|
||||
func client_disconnected_from_server() -> void:
|
||||
push_warning("Disconnected from, server...")
|
||||
|
||||
func client_connection_failed_to_server() -> void:
|
||||
push_warning("Connection failed!")
|
||||
|
||||
unset_client()
|
||||
|
||||
func unset_client() -> void:
|
||||
if not peer: return
|
||||
|
||||
Reference in New Issue
Block a user