aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-04-25 01:03:15 +0200
committer Hop311 <hop3114@gmail.com>2023-04-25 01:03:15 +0200
commit8fba1c8a02f8680e0d80279b8b6451fea4a40a62 (patch)
treeba88378d61e2121a26847b2f68ac5111b5c9baec /game
parent639f86febf39184cccde9f898fc328375048233f (diff)
Req comments + cleanup + c++ registry refactoring
Diffstat (limited to 'game')
-rw-r--r--game/localisation/en_GB/menus.csv1
-rw-r--r--game/src/GameSession/GameSpeedPanel.gd1
-rw-r--r--game/src/GameSession/ProvinceOverviewPanel.gd10
-rw-r--r--game/src/GameSession/ProvinceOverviewPanel.tscn7
4 files changed, 17 insertions, 2 deletions
diff --git a/game/localisation/en_GB/menus.csv b/game/localisation/en_GB/menus.csv
index 0009acd..3c3fff1 100644
--- a/game/localisation/en_GB/menus.csv
+++ b/game/localisation/en_GB/menus.csv
@@ -69,6 +69,7 @@ DIALOG_SAVE_AND_QUIT,Save and Quit
,, Province Overview Panel
province_MISSING,No Province
region_MISSING,No Region
+LIFE_RATING_TOOLTIP,Liferating: %d
building_MISSING,No Building
building_fort,Fort
building_naval_base,Naval Base
diff --git a/game/src/GameSession/GameSpeedPanel.gd b/game/src/GameSession/GameSpeedPanel.gd
index 8b7af29..80708b1 100644
--- a/game/src/GameSession/GameSpeedPanel.gd
+++ b/game/src/GameSession/GameSpeedPanel.gd
@@ -7,7 +7,6 @@ extends PanelContainer
@export var _decrease_speed_button : Button
@export var _increase_speed_button : Button
-# Called when the node enters the scene tree for the first time.
func _ready():
GameSingleton.state_updated.connect(_update_buttons)
_update_buttons()
diff --git a/game/src/GameSession/ProvinceOverviewPanel.gd b/game/src/GameSession/ProvinceOverviewPanel.gd
index cbab9d0..17da9d0 100644
--- a/game/src/GameSession/ProvinceOverviewPanel.gd
+++ b/game/src/GameSession/ProvinceOverviewPanel.gd
@@ -2,6 +2,7 @@ extends PanelContainer
@export var _province_name_label : Label
@export var _region_name_label : Label
+@export var _life_rating_bar : ProgressBar
@export var _buildings_container : Container
const _missing_suffix : String = "_MISSING"
@@ -23,6 +24,10 @@ func _expand_building(building_identifier : String) -> void:
if GameSingleton.expand_building(_selected_index, building_identifier) != OK:
push_error("Failed to expand ", building_identifier, " in province #", _selected_index);
+# REQUIREMENTS:
+# * UI-183, UI-185, UI-186, UI-765, UI-187, UI-188, UI-189
+# * UI-191, UI-193, UI-194, UI-766, UI-195, UI-196, UI-197
+# * UI-199, UI-201, UI-202, UI-767, UI-203, UI-204, UI-205
func _add_building(building : Dictionary) -> void:
const _building_key : StringName = &"building"
const _level_key : StringName = &"level"
@@ -62,11 +67,16 @@ func update_info() -> void:
const _life_rating_key : StringName = &"life_rating"
const _buildings_key : StringName = &"buildings"
+ const _life_rating_tooltip : String = "LIFE_RATING_TOOLTIP"
+
_province_info = GameSingleton.get_province_info_from_index(_selected_index)
if _province_info:
_province_name_label.text = _province_info.get(_province_key, _province_key + _missing_suffix)
_region_name_label.text = _province_info.get(_region_key, _region_key + _missing_suffix)
+ _life_rating_bar.value = _province_info.get(_life_rating_key, 0)
+ _life_rating_bar.tooltip_text = tr(_life_rating_tooltip) % _life_rating_bar.value
+
for child in _buildings_container.get_children():
_buildings_container.remove_child(child)
child.queue_free()
diff --git a/game/src/GameSession/ProvinceOverviewPanel.tscn b/game/src/GameSession/ProvinceOverviewPanel.tscn
index 7b28cc1..48e7c25 100644
--- a/game/src/GameSession/ProvinceOverviewPanel.tscn
+++ b/game/src/GameSession/ProvinceOverviewPanel.tscn
@@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://src/GameSession/ProvinceOverviewPanel.gd" id="1_3n8k5"]
-[node name="ProvinceOverviewPanel" type="PanelContainer" node_paths=PackedStringArray("_province_name_label", "_region_name_label", "_buildings_container")]
+[node name="ProvinceOverviewPanel" type="PanelContainer" node_paths=PackedStringArray("_province_name_label", "_region_name_label", "_life_rating_bar", "_buildings_container")]
editor_description = "UI-56"
anchors_preset = 2
anchor_top = 1.0
@@ -13,6 +13,7 @@ grow_vertical = 0
script = ExtResource("1_3n8k5")
_province_name_label = NodePath("PanelList/TopBarList/NameList/ProvinceName")
_region_name_label = NodePath("PanelList/TopBarList/NameList/RegionName")
+_life_rating_bar = NodePath("PanelList/TopBarList/NameList/LifeRatingBar")
_buildings_container = NodePath("PanelList/InteractList/BuildingsContainer")
[node name="PanelList" type="VBoxContainer" parent="."]
@@ -38,6 +39,10 @@ layout_mode = 2
text = "region_MISSING"
vertical_alignment = 1
+[node name="LifeRatingBar" type="ProgressBar" parent="PanelList/TopBarList/NameList"]
+editor_description = "UI-62"
+layout_mode = 2
+
[node name="CloseButton" type="Button" parent="PanelList/TopBarList"]
custom_minimum_size = Vector2(30, 30)
layout_mode = 2