diff options
author | George L. Albany <Megacake1234@gmail.com> | 2023-06-04 02:17:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-04 02:17:28 +0200 |
commit | 3236f51d700674aee6ee6572109ffb3d5fa5fed2 (patch) | |
tree | b898150a8a45e7c0d814459e7f12f39429acefeb /game/src/Game/GameSession/GameSpeedPanel.gd | |
parent | 73e29d02e48739aba5ca5db1b9575c67e795400f (diff) | |
parent | b98166b28c47cccff731d30959b8250fb27ff408 (diff) |
Merge pull request #130 from Spartan322/organize/godot-project
Diffstat (limited to 'game/src/Game/GameSession/GameSpeedPanel.gd')
-rw-r--r-- | game/src/Game/GameSession/GameSpeedPanel.gd | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/game/src/Game/GameSession/GameSpeedPanel.gd b/game/src/Game/GameSession/GameSpeedPanel.gd new file mode 100644 index 0000000..80708b1 --- /dev/null +++ b/game/src/Game/GameSession/GameSpeedPanel.gd @@ -0,0 +1,37 @@ +extends PanelContainer + +#UI-74 UI-75 UI-76 UI-77 + +@export var _longform_date_button : Button +@export var _play_pause_display_button : Button +@export var _decrease_speed_button : Button +@export var _increase_speed_button : Button + +func _ready(): + 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() + + _longform_date_button.text = GameSingleton.get_longform_date() + + +func _on_decrease_speed_button_pressed(): + GameSingleton.decrease_speed() + _update_buttons() + +func _on_increase_speed_button_pressed(): + GameSingleton.increase_speed() + _update_buttons() + +func _on_play_pause_display_button_pressed(): + GameSingleton.toggle_paused() + _update_buttons() + +func _on_longform_date_label_pressed(): + GameSingleton.toggle_paused() + _update_buttons() |