diff options
author | Hop311 <Hop3114@gmail.com> | 2024-01-01 20:45:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-01 20:45:57 +0100 |
commit | cf34ce1d7459ee91fc75e89835a8e7171fac636b (patch) | |
tree | 54c19503dc6e1bfbda1e11cf5f403e5038046cbe /game | |
parent | 8fc620484ac406c7a86b92553d77a0bd20e4143b (diff) | |
parent | c0cc6e202c33fb3889d0025b1b04148ae66545f2 (diff) |
Merge pull request #181 from OpenVicProject/ui-state-style
UI polish
Diffstat (limited to 'game')
-rw-r--r-- | game/src/Game/GameSession/GameSession.tscn | 8 | ||||
-rw-r--r-- | game/src/Game/GameSession/ProvinceOverviewPanel.gd | 2 | ||||
-rw-r--r-- | game/src/Game/GameSession/Topbar.gd | 22 |
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() |