Moving some of game to use MessageBus
This commit is contained in:
@@ -16,16 +16,12 @@ func connect_to_game() -> void:
|
||||
Globals.multiplayer_data.wait_for_connection_close()
|
||||
|
||||
# NOTE: Join target game server
|
||||
# TODO: Don't use libby client... Use a created game client.
|
||||
lobby_ui.client.start_client(
|
||||
Globals.game_data.game_address,
|
||||
Globals.game_data.game_port
|
||||
)
|
||||
|
||||
@rpc("authority", "call_local", "reliable")
|
||||
func load_game_scene(match_entry: Dictionary, is_player_1: bool) -> void:
|
||||
push_warning("Client load game scene...")
|
||||
lobby_ui.rpc_signals.match_list_entry_load_match.emit(match_entry, is_player_1)
|
||||
|
||||
@rpc("authority", "reliable")
|
||||
func go_back_to_match_screen() -> void:
|
||||
if multiplayer.is_server(): return
|
||||
@@ -35,16 +31,3 @@ func go_back_to_match_screen() -> void:
|
||||
Globals.game_state.set_game_scene(
|
||||
"res://scenes/screens/lobby_screen/lobby.tscn"
|
||||
)
|
||||
|
||||
# NOTE: Needed for hash check to pass between client and server but isn't used by client...
|
||||
@rpc("any_peer", "reliable")
|
||||
func match_list_add_entry(_match_entry: Dictionary) -> void:
|
||||
pass
|
||||
|
||||
@rpc("any_peer", "reliable")
|
||||
func match_list_remove_entry(_match_id: String) -> void:
|
||||
pass
|
||||
|
||||
@rpc("any_peer", "reliable")
|
||||
func match_list_join_entry(_match_id: String) -> void:
|
||||
pass
|
||||
|
||||
@@ -30,13 +30,18 @@ func init_match():
|
||||
|
||||
rpc("set_active_player_id", Globals.game_data.client1)
|
||||
|
||||
Globals.lobby_data.rpc_id(
|
||||
MessageBus.emit_propagation_clients_only.rpc_id(
|
||||
Globals.game_data.client1,
|
||||
"load_game_scene", match_entry, true
|
||||
"match_list_entry_load_match",
|
||||
[match_entry, true],
|
||||
true
|
||||
)
|
||||
Globals.lobby_data.rpc_id(
|
||||
|
||||
MessageBus.emit_propagation_clients_only.rpc_id(
|
||||
Globals.game_data.client2,
|
||||
"load_game_scene", match_entry, false
|
||||
"match_list_entry_load_match",
|
||||
[match_entry, false],
|
||||
true
|
||||
)
|
||||
|
||||
func wait_for_connection() -> void:
|
||||
|
||||
Reference in New Issue
Block a user