aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-12-30 15:59:20 +0100
committer hop311 <hop3114@gmail.com>2023-12-30 15:59:20 +0100
commitc0cc6e202c33fb3889d0025b1b04148ae66545f2 (patch)
tree65ef49b0d12cf307269defeb0960f25ea442f777 /game/src/Game
parentf2f42d1b65605876a6ec12626be55183b4681b88 (diff)
Added button state textures + block colour progress bars
Diffstat (limited to 'game/src/Game')
-rw-r--r--game/src/Game/GameSession/GameSession.tscn8
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel.gd2
-rw-r--r--game/src/Game/GameSession/Topbar.gd22
3 files changed, 17 insertions, 15 deletions
diff --git a/game/src/Game/GameSession/GameSession.tscn b/game/src/Game/GameSession/GameSession.tscn
index a3a5f38..c7a8003 100644
--- a/game/src/Game/GameSession/GameSession.tscn
+++ b/game/src/Game/GameSession/GameSession.tscn
@@ -27,19 +27,11 @@ _game_session_menu = NodePath("GameSessionMenu")
[node name="ProvinceOverviewPanel" type="GUINode" parent="."]
layout_mode = 1
anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
script = ExtResource("5_lfv8l")
[node name="Topbar" type="GUINode" parent="."]
layout_mode = 1
anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
script = ExtResource("4_2kbih")
[node name="MapControlPanel" parent="." instance=ExtResource("3_afh6d")]
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel.gd b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
index 6ffc906..8920b26 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel.gd
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
@@ -119,7 +119,7 @@ var _province_info : Dictionary
func _ready() -> void:
GameSingleton.province_selected.connect(_on_province_selected)
- GameSingleton.state_updated.connect(_update_info)
+ GameSingleton.gamestate_updated.connect(_update_info)
if add_gui_element("province_interface.gui", "province_view") != OK:
push_error("Failed to generate province overview panel!")
diff --git a/game/src/Game/GameSession/Topbar.gd b/game/src/Game/GameSession/Topbar.gd
index 4de9474..b6a170f 100644
--- a/game/src/Game/GameSession/Topbar.gd
+++ b/game/src/Game/GameSession/Topbar.gd
@@ -8,7 +8,8 @@ var _date_label : Label
var _country_name_label : Label
func _ready() -> void:
- GameSingleton.state_updated.connect(_update_info)
+ GameSingleton.gamestate_updated.connect(_update_info)
+ GameSingleton.clock_state_changed.connect(_update_speed_controls)
add_gui_element("topbar.gui", "topbar")
@@ -42,13 +43,25 @@ func _ready() -> void:
_country_name_label.text = player_country
_speed_indicator_button = get_button_from_nodepath(^"./topbar/speed_indicator")
- _speed_indicator_texture = get_gfx_icon_texture_from_nodepath(^"./topbar/speed_indicator")
+ if _speed_indicator_button:
+ _speed_indicator_button.pressed.connect(_on_play_pause_button_pressed)
+ _speed_indicator_texture = get_gfx_icon_texture_from_node(_speed_indicator_button)
+
+ _update_info()
+ _update_speed_controls()
+
+func _notification(what : int) -> void:
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
func _update_info() -> void:
if _date_label:
_date_label.text = GameSingleton.get_longform_date()
- # TODO - add disabled state textures so this doesn't hide the buttons
+func _update_speed_controls() -> void:
+ # TODO - decide whether to disable these or not
+ # (they don't appear to get disabled in the base game)
#if _speed_up_button:
# _speed_up_button.disabled = not GameSingleton.can_increase_speed()
@@ -67,18 +80,15 @@ func _update_info() -> void:
func _on_play_pause_button_pressed() -> void:
print("Toggling pause!")
GameSingleton.toggle_paused()
- _update_info()
# REQUIREMENTS:
# * UIFUN-72
func _on_increase_speed_button_pressed() -> void:
print("Speed up!")
GameSingleton.increase_speed()
- _update_info()
# REQUIREMENTS:
# * UIFUN-73
func _on_decrease_speed_button_pressed() -> void:
print("Speed down!")
GameSingleton.decrease_speed()
- _update_info()