refactor: reorganize networking and data bridge scenes
* Move networking scenes under `controllers/networking` * Move data bridge scene under `scenes/data` * Rename the bridge node to `data_bridge` * Update lobby UI scene path * Remove unused lobby RPC node/script
This commit is contained in:
31
scenes/data/lobby_data.gd
Normal file
31
scenes/data/lobby_data.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
class_name LobbyData extends Node
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
Globals.lobby_data = self
|
||||
|
||||
|
||||
@rpc("authority", "reliable")
|
||||
func connect_to_game() -> void:
|
||||
# NOTE: Leave the lobby
|
||||
MessageBus.emit_local("lobby_close_connection", null)
|
||||
|
||||
# NOTE: Join target game server
|
||||
MessageBus.emit_local(
|
||||
"game_start_client",
|
||||
[
|
||||
Globals.game_data.game_address,
|
||||
Globals.game_data.game_port
|
||||
],
|
||||
true
|
||||
)
|
||||
|
||||
@rpc("authority", "reliable")
|
||||
func go_back_to_match_screen() -> void:
|
||||
if multiplayer.is_server(): return
|
||||
|
||||
push_warning("Client peer disconnected...")
|
||||
|
||||
Globals.game_state.set_game_scene(
|
||||
"res://scenes/screens/lobby_screen/lobby.tscn"
|
||||
)
|
||||
Reference in New Issue
Block a user