diff options
author | nokoe <nokoe@mailbox.org> | 2024-09-28 12:00:48 +0200 |
---|---|---|
committer | nokoe <nokoe@mailbox.org> | 2024-09-28 12:02:43 +0200 |
commit | 04ddfc807a0e275d69e82222c7a7fcb39c979e02 (patch) | |
tree | adbe8ce929bc2fb81914b8b90be4115ddfcef8cc /client/menu/lobby.gd | |
parent | 045e34f78a498230f39101ce215424fcdcec9eb0 (diff) | |
download | hurrycurry-04ddfc807a0e275d69e82222c7a7fcb39c979e02.tar hurrycurry-04ddfc807a0e275d69e82222c7a7fcb39c979e02.tar.bz2 hurrycurry-04ddfc807a0e275d69e82222c7a7fcb39c979e02.tar.zst |
replace `is_joined` and `join_sent` with `join_state`
Diffstat (limited to 'client/menu/lobby.gd')
-rw-r--r-- | client/menu/lobby.gd | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/client/menu/lobby.gd b/client/menu/lobby.gd index 0dca6f4c..d595444e 100644 --- a/client/menu/lobby.gd +++ b/client/menu/lobby.gd @@ -52,8 +52,8 @@ func _ready(): game.update_players.connect(update_players) initialize() game.data_updated.connect(initialize) - game.joined.connect(_on_game_joined) - game.left.connect(_on_game_left) + game.join_state_updated.connect(_on_game_join_state_updated) + _on_game_join_state_updated(game.join_state) check_for_music() func initialize(): @@ -145,18 +145,6 @@ func _input(_event): elif Input.is_action_just_pressed("next") and not next_map.disabled: next_map.emit_signal("pressed") -func _on_game_joined(): - map_selector.show() - map_list.show() - bots_container.show() - start_button.disabled = false - -func _on_game_left(): - map_selector.hide() - map_list.hide() - bots_container.hide() - start_button.disabled = true - func _on_left_pressed(): selected_map = (selected_map - 1) % map_count select_map(selected_map) @@ -177,13 +165,27 @@ func _on_controller_button_pressed(): game.mp.send_chat(game.player_id, start_msg) Sound.play_music("stop") # TODO: Game music enter +func _on_game_join_state_updated(state: Game.JoinState): + match state: + Game.JoinState.JOINED: + map_selector.show() + map_list.show() + bots_container.show() + start_button.disabled = false + join_spectate.disabled = false + join_spectate.text = tr("c.menu.ingame.spectate") + Game.JoinState.SPECTATING: + map_selector.hide() + map_list.hide() + bots_container.hide() + start_button.disabled = true + join_spectate.disabled = false + join_spectate.text = tr("c.menu.ingame.join") + Game.JoinState.WAITING: + join_spectate.disabled = true + func _on_join_spectate_pressed(): - if game.is_joined: - game.leave() - join_spectate.text = tr("c.menu.ingame.join") - elif not game.join_sent: - game.join() - join_spectate.text = tr("c.menu.ingame.spectate") + game.toggle_join() func check_for_music(): if visible: |