diff options
author | Hop311 <Hop3114@gmail.com> | 2023-04-23 20:52:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-23 20:52:33 +0200 |
commit | 7f433fe019310ecfd1d1c46afd97cbfcb210c88f (patch) | |
tree | 60971db586e78761341f2b48110d149b1ba0db9d /game/src/GameSession/GameSpeedPanel.gd | |
parent | c041b291c887db90a4e1112ffdd1e56865c27b13 (diff) | |
parent | d3f3187209cb4085f27f95ce8ad2a77af25704fd (diff) |
Merge pull request #94 from OpenVic2Project/province-buildings
Province buildings
Diffstat (limited to 'game/src/GameSession/GameSpeedPanel.gd')
-rw-r--r-- | game/src/GameSession/GameSpeedPanel.gd | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/game/src/GameSession/GameSpeedPanel.gd b/game/src/GameSession/GameSpeedPanel.gd index 8dc35d7..c203032 100644 --- a/game/src/GameSession/GameSpeedPanel.gd +++ b/game/src/GameSession/GameSpeedPanel.gd @@ -7,27 +7,32 @@ extends PanelContainer @export var _decrease_speed_button : Button @export var _increase_speed_button : Button -var is_game_paused : bool = true - # Called when the node enters the scene tree for the first time. func _ready(): - _update_playpause_button() + GameSingleton.state_updated.connect(_update_buttons) + _update_buttons() + +func _update_buttons(): + _play_pause_display_button.text = "⏸️" if GameSingleton.is_paused() else "▶" + + _increase_speed_button.disabled = not GameSingleton.can_increase_speed() + _decrease_speed_button.disabled = not GameSingleton.can_decrease_speed() -func _update_playpause_button(): - _play_pause_display_button.text = "⏸️" if is_game_paused else "▶" - print("Game is paused" if is_game_paused else "Game is advancing") + _longform_date_button.text = GameSingleton.get_longform_date() func _on_decrease_speed_button_pressed(): - print("Decrease speed") + GameSingleton.decrease_speed() + _update_buttons() func _on_increase_speed_button_pressed(): - print("Increase speed") + GameSingleton.increase_speed() + _update_buttons() func _on_play_pause_display_button_pressed(): - is_game_paused = !is_game_paused - _update_playpause_button() + GameSingleton.toggle_paused() + _update_buttons() func _on_longform_date_label_pressed(): - is_game_paused = !is_game_paused - _update_playpause_button() + GameSingleton.toggle_paused() + _update_buttons() |