diff options
author | tpart <tpart120@proton.me> | 2024-09-28 20:38:56 +0200 |
---|---|---|
committer | tpart <tpart120@proton.me> | 2024-09-28 20:38:56 +0200 |
commit | 5cd87fc5d570d584019a6d6dd8dc25b6e5f274a0 (patch) | |
tree | e581a7a973813ea93e230438a9718e4e675c5c5a | |
parent | 40f4dddf5b8dcdc53996d981bf01d124584038df (diff) | |
download | hurrycurry-5cd87fc5d570d584019a6d6dd8dc25b6e5f274a0.tar hurrycurry-5cd87fc5d570d584019a6d6dd8dc25b6e5f274a0.tar.bz2 hurrycurry-5cd87fc5d570d584019a6d6dd8dc25b6e5f274a0.tar.zst |
Refactor in_lobby code in popup message
-rw-r--r-- | client/game.gd | 9 | ||||
-rw-r--r-- | client/menu/communicate/popup_message/popup_message.gd | 13 |
2 files changed, 8 insertions, 14 deletions
diff --git a/client/game.gd b/client/game.gd index a34ff57e..fe1e9ba6 100644 --- a/client/game.gd +++ b/client/game.gd @@ -247,18 +247,15 @@ func handle_packet(p): map.gi_bake() await get_parent()._menu_open() map.autobake = true - - if in_lobby: popup_message.lobby() - else: popup_message.ingame() + + in_lobby_updated.emit(in_lobby) else: map.autobake = false await get_parent()._menu_exit() - + lobby.visible = in_lobby if lobby and join_state == JoinState.SPECTATING: toggle_join() - - in_lobby_updated.emit(in_lobby) "score": if p.time_remaining != null: overlay.update(p.demands_failed, p.demands_completed, p.points, p.time_remaining) diff --git a/client/menu/communicate/popup_message/popup_message.gd b/client/menu/communicate/popup_message/popup_message.gd index 7a4dce4b..98bd94e3 100644 --- a/client/menu/communicate/popup_message/popup_message.gd +++ b/client/menu/communicate/popup_message/popup_message.gd @@ -50,6 +50,11 @@ func _ready(): else: update_state() ) + game.in_lobby_updated.connect( + func a(in_lobby): + is_ingame = not in_lobby + update_state() + ) func _process(_delta: float): for pos: Vector2 in positional_messages.keys(): @@ -66,14 +71,6 @@ func _process(_delta: float): msg.last_size = msg.node.size msg.node.position = -0.5 * msg.last_size -func ingame(): - is_ingame = true - update_state() - -func lobby(): - is_ingame = false - update_state() - func update_state(): if is_ingame and is_joined: start_game_hints() |