aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-08-30 23:29:57 +0200
committer GitHub <noreply@github.com>2024-08-30 23:29:57 +0200
commitf54e454afb90f8868e7c62529e2a388fdaadf20b (patch)
treef19dbcdfe613397e86dc52cc34e0a443bd0f3e96 /game/src/Game
parent855e5b087459da19caf230cf22d99462680b268e (diff)
parentd7672f406406eea46625bc725690651f28211e19 (diff)
Merge pull request #251 from OpenVicProject/gui-text-label
Add GUILabel (colour code + currency icon support)
Diffstat (limited to 'game/src/Game')
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd150
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd50
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel.gd64
-rw-r--r--game/src/Game/GameSession/Topbar.gd204
-rw-r--r--game/src/Game/GameStart.gd3
5 files changed, 211 insertions, 260 deletions
diff --git a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
index 42f0791..20eb198 100644
--- a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
@@ -4,36 +4,36 @@ var _active : bool = false
var _incVal : int = 0 # incremental value to see the UI update, replace later by real values
# income
-var _lower_class_label : Label
-var _middle_class_label : Label
-var _upper_class_label : Label
-var _gold_label : Label
-var _total_inc_label : Label
+var _lower_class_label : GUILabel
+var _middle_class_label : GUILabel
+var _upper_class_label : GUILabel
+var _gold_label : GUILabel
+var _total_inc_label : GUILabel
# debt
-var _national_bank_label : Label
-var _total_funds_label : Label
-var _debt_val_label : Label
-var _interest_val_label : Label
+var _national_bank_label : GUILabel
+var _total_funds_label : GUILabel
+var _debt_val_label : GUILabel
+var _interest_val_label : GUILabel
# costs
-var _nat_stock_val_label : Label
-var _nat_stock_exp_label : Label
-var _mil_cost_val_label : Label
-var _overseas_cost_val_label : Label
-var _ind_sub_val_label : Label
-var _admin_efficiency_label : Label
-var _education_exp_label : Label
-var _administration_exp_label : Label
-var _social_exp_label : Label
-var _military_exp_label : Label
-var _total_exp_label : Label
+var _nat_stock_val_label : GUILabel
+var _nat_stock_exp_label : GUILabel
+var _mil_cost_val_label : GUILabel
+var _overseas_cost_val_label : GUILabel
+var _ind_sub_val_label : GUILabel
+var _admin_efficiency_label : GUILabel
+var _education_exp_label : GUILabel
+var _administration_exp_label : GUILabel
+var _social_exp_label : GUILabel
+var _military_exp_label : GUILabel
+var _total_exp_label : GUILabel
# others
-var _tariffs_percent_label : Label
-var _tariff_val_label : Label
-var _diplomatic_balance_label : Label
-var _balance_label : Label
+var _tariffs_percent_label : GUILabel
+var _tariff_val_label : GUILabel
+var _diplomatic_balance_label : GUILabel
+var _balance_label : GUILabel
var _lower_class_chart : GFXPieChartTexture
var _middle_class_chart : GFXPieChartTexture
@@ -55,92 +55,92 @@ func _ready() -> void:
# labels
# income
- _lower_class_label = get_label_from_nodepath(^"./country_budget/tax_0_inc")
- _middle_class_label = get_label_from_nodepath(^"./country_budget/tax_1_inc")
- _upper_class_label = get_label_from_nodepath(^"./country_budget/tax_2_inc")
- _gold_label = get_label_from_nodepath(^"./country_budget/gold_inc")
- _total_inc_label = get_label_from_nodepath(^"./country_budget/total_inc")
+ _lower_class_label = get_gui_label_from_nodepath(^"./country_budget/tax_0_inc")
+ _middle_class_label = get_gui_label_from_nodepath(^"./country_budget/tax_1_inc")
+ _upper_class_label = get_gui_label_from_nodepath(^"./country_budget/tax_2_inc")
+ _gold_label = get_gui_label_from_nodepath(^"./country_budget/gold_inc")
+ _total_inc_label = get_gui_label_from_nodepath(^"./country_budget/total_inc")
# debt
- _national_bank_label = get_label_from_nodepath(^"./country_budget/national_bank_val")
- _total_funds_label = get_label_from_nodepath(^"./country_budget/total_funds_val")
- _debt_val_label = get_label_from_nodepath(^"./country_budget/debt_val")
- _interest_val_label = get_label_from_nodepath(^"./country_budget/interest_val")
+ _national_bank_label = get_gui_label_from_nodepath(^"./country_budget/national_bank_val")
+ _total_funds_label = get_gui_label_from_nodepath(^"./country_budget/total_funds_val")
+ _debt_val_label = get_gui_label_from_nodepath(^"./country_budget/debt_val")
+ _interest_val_label = get_gui_label_from_nodepath(^"./country_budget/interest_val")
# costs
- _nat_stock_val_label = get_label_from_nodepath(^"./country_budget/nat_stock_val")
- _nat_stock_exp_label = get_label_from_nodepath(^"./country_budget/nat_stock_est")
- _mil_cost_val_label = get_label_from_nodepath(^"./country_budget/mil_cost_val")
- _overseas_cost_val_label = get_label_from_nodepath(^"./country_budget/overseas_cost_val")
- _ind_sub_val_label = get_label_from_nodepath(^"./country_budget/ind_sub_val")
- _admin_efficiency_label = get_label_from_nodepath(^"./country_budget/admin_efficiency")
- _education_exp_label = get_label_from_nodepath(^"./country_budget/exp_val_0")
- _administration_exp_label = get_label_from_nodepath(^"./country_budget/exp_val_1")
- _social_exp_label = get_label_from_nodepath(^"./country_budget/exp_val_2")
- _military_exp_label = get_label_from_nodepath(^"./country_budget/exp_val_3")
- _total_exp_label = get_label_from_nodepath(^"./country_budget/total_exp")
+ _nat_stock_val_label = get_gui_label_from_nodepath(^"./country_budget/nat_stock_val")
+ _nat_stock_exp_label = get_gui_label_from_nodepath(^"./country_budget/nat_stock_est")
+ _mil_cost_val_label = get_gui_label_from_nodepath(^"./country_budget/mil_cost_val")
+ _overseas_cost_val_label = get_gui_label_from_nodepath(^"./country_budget/overseas_cost_val")
+ _ind_sub_val_label = get_gui_label_from_nodepath(^"./country_budget/ind_sub_val")
+ _admin_efficiency_label = get_gui_label_from_nodepath(^"./country_budget/admin_efficiency")
+ _education_exp_label = get_gui_label_from_nodepath(^"./country_budget/exp_val_0")
+ _administration_exp_label = get_gui_label_from_nodepath(^"./country_budget/exp_val_1")
+ _social_exp_label = get_gui_label_from_nodepath(^"./country_budget/exp_val_2")
+ _military_exp_label = get_gui_label_from_nodepath(^"./country_budget/exp_val_3")
+ _total_exp_label = get_gui_label_from_nodepath(^"./country_budget/total_exp")
# others
- _tariffs_percent_label = get_label_from_nodepath(^"./country_budget/tariffs_percent")
- _tariff_val_label = get_label_from_nodepath(^"./country_budget/tariff_val")
- _diplomatic_balance_label = get_label_from_nodepath(^"./country_budget/diplomatic_balance")
- _balance_label = get_label_from_nodepath(^"./country_budget/balance")
+ _tariffs_percent_label = get_gui_label_from_nodepath(^"./country_budget/tariffs_percent")
+ _tariff_val_label = get_gui_label_from_nodepath(^"./country_budget/tariff_val")
+ _diplomatic_balance_label = get_gui_label_from_nodepath(^"./country_budget/diplomatic_balance")
+ _balance_label = get_gui_label_from_nodepath(^"./country_budget/balance")
# sliders
# income
var _lower_class_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/tax_0_slider")
if _lower_class_slider and _lower_class_label:
- _lower_class_slider.value_changed.connect(func(value : int) -> void: _lower_class_label.text = "%s£" % value)
+ _lower_class_slider.value_changed.connect(func(value : int) -> void: _lower_class_label.text = "%s¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1))
_lower_class_slider.emit_value_changed()
var _middle_class_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/tax_1_slider")
if _middle_class_slider and _middle_class_label:
- _middle_class_slider.value_changed.connect(func(value : int) -> void: _middle_class_label.text = "%s£" % value)
+ _middle_class_slider.value_changed.connect(func(value : int) -> void: _middle_class_label.text = "%s¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1))
_middle_class_slider.emit_value_changed()
var _upper_class_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/tax_2_slider")
if _upper_class_slider and _upper_class_label:
- _upper_class_slider.value_changed.connect(func(value : int) -> void: _upper_class_label.text = "%s£" % value)
+ _upper_class_slider.value_changed.connect(func(value : int) -> void: _upper_class_label.text = "%s¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1))
_upper_class_slider.emit_value_changed()
# costs
var _land_stockpile_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/land_stockpile_slider")
if _land_stockpile_slider and _mil_cost_val_label:
- _land_stockpile_slider.value_changed.connect(func(value : int) -> void: _mil_cost_val_label.text = "%s£" % value)
+ _land_stockpile_slider.value_changed.connect(func(value : int) -> void: _mil_cost_val_label.text = "%s¤" % GUINode.float_to_string_dp(value, 2))
_land_stockpile_slider.emit_value_changed()
var _naval_stockpile_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/naval_stockpile_slider")
if _naval_stockpile_slider and _overseas_cost_val_label:
- _naval_stockpile_slider.value_changed.connect(func(value : int) -> void: _overseas_cost_val_label.text = "%s£" % value)
+ _naval_stockpile_slider.value_changed.connect(func(value : int) -> void: _overseas_cost_val_label.text = "%s¤" % GUINode.float_to_string_dp(value, 1))
_naval_stockpile_slider.emit_value_changed()
var _projects_stockpile_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/projects_stockpile_slider")
if _projects_stockpile_slider:
if _nat_stock_val_label:
- _projects_stockpile_slider.value_changed.connect(func(value : int) -> void: _nat_stock_val_label.text = "%s£" % value)
+ _projects_stockpile_slider.value_changed.connect(func(value : int) -> void: _nat_stock_val_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(value))
if _nat_stock_exp_label:
- _projects_stockpile_slider.value_changed.connect(func(value : int) -> void: _nat_stock_exp_label.text = "%s£" % value)
+ _projects_stockpile_slider.value_changed.connect(func(value : int) -> void: _nat_stock_exp_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(value))
_projects_stockpile_slider.emit_value_changed()
var _exp_0_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/exp_0_slider")
if _exp_0_slider and _education_exp_label:
- _exp_0_slider.value_changed.connect(func(value : int) -> void: _education_exp_label.text = "%s£" % value)
+ _exp_0_slider.value_changed.connect(func(value : int) -> void: _education_exp_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(value))
_exp_0_slider.emit_value_changed()
var _exp_1_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/exp_1_slider")
if _exp_1_slider:
if _administration_exp_label:
- _exp_1_slider.value_changed.connect(func(value : int) -> void: _administration_exp_label.text = "%s£" % value)
+ _exp_1_slider.value_changed.connect(func(value : int) -> void: _administration_exp_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(value))
if _admin_efficiency_label:
- _exp_1_slider.value_changed.connect(func(value : int) -> void: _admin_efficiency_label.text = "%s%%" % value)
+ _exp_1_slider.value_changed.connect(func(value : int) -> void: _admin_efficiency_label.text = "%s%%" % GUINode.float_to_string_dp(value, 1))
_exp_1_slider.emit_value_changed()
var _exp_2_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/exp_2_slider")
if _exp_2_slider and _social_exp_label:
- _exp_2_slider.value_changed.connect(func(value : int) -> void: _social_exp_label.text = "%s£" % value)
+ _exp_2_slider.value_changed.connect(func(value : int) -> void: _social_exp_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(value))
_exp_2_slider.emit_value_changed()
var _exp_3_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/exp_3_slider")
if _exp_3_slider and _military_exp_label:
- _exp_3_slider.value_changed.connect(func(value : int) -> void: _military_exp_label.text = "%s£" % value)
+ _exp_3_slider.value_changed.connect(func(value : int) -> void: _military_exp_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(value))
_exp_3_slider.emit_value_changed()
# others
var _tariff_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/tariff_slider")
if _tariff_slider:
if _tariff_val_label:
- _tariff_slider.value_changed.connect(func(value : int) -> void: _tariff_val_label.text = "%s£" % value)
+ _tariff_slider.value_changed.connect(func(value : int) -> void: _tariff_val_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(value))
if _tariffs_percent_label:
- _tariff_slider.value_changed.connect(func(value : int) -> void: _tariffs_percent_label.text = "%s%%" % value)
+ _tariff_slider.value_changed.connect(func(value : int) -> void: _tariffs_percent_label.text = "%s%%" % GUINode.float_to_string_dp(value, 1))
_tariff_slider.emit_value_changed()
# debt buttons
@@ -188,38 +188,36 @@ func _update_info() -> void:
if _active:
if _gold_label:
- _gold_label.text = "%s£" % (_incVal - (_incVal % 7))
+ _gold_label.text = "%s¤" % GUINode.float_to_string_dp(_incVal - (_incVal % 7), 1)
if _total_inc_label:
- _total_inc_label.text = "%s£" % _incVal
+ _total_inc_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(_incVal)
if _national_bank_label:
- _national_bank_label.text = "%s£" % (_incVal * 2)
+ _national_bank_label.text = "%s¤" % GUINode.float_to_string_suffixed(_incVal * 2)
if _total_funds_label:
- _total_funds_label.text = "%s£" % (_incVal * 3)
+ _total_funds_label.text = "%s¤" % GUINode.float_to_string_suffixed(_incVal * 3)
if _debt_val_label:
- _debt_val_label.text = "%s£" % (_incVal * 4)
+ _debt_val_label.text = "%s¤" % GUINode.float_to_string_dp(_incVal * 4, 1)
if _interest_val_label:
- _interest_val_label.text = "%s£" % (_incVal * 5)
+ _interest_val_label.text = "%s¤" % GUINode.float_to_string_dp(_incVal * 5, 2)
if _ind_sub_val_label:
- _ind_sub_val_label.text = "%s£" % (_incVal * 6)
+ _ind_sub_val_label.text = "%s¤" % GUINode.float_to_string_dp(_incVal * 6, 1)
if _diplomatic_balance_label:
- _diplomatic_balance_label.text = "%s£" % (_incVal * 8)
+ # TODO - check colours and +/- when non-zero
+ _diplomatic_balance_label.text = "§Y%s¤" % GUINode.float_to_string_dp(_incVal * 8, 1)
if _total_exp_label:
- _total_exp_label.text = "%s£" % (_incVal + 1)
+ _total_exp_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(_incVal + 1)
if _balance_label:
- _balance_label.text = "%s£" % _incVal
- _balance_label.add_theme_color_override(&"font_color",
- Color.DARK_GREEN if _incVal > 0 else
- (Color.RED if _incVal < 0 else Color.BLACK)
- )
+ var balance : float = _incVal * 2.5
+ _balance_label.text = "§%s%s¤" % ["G+" if balance > 0.0 else "R" if balance < 0.0 else "Y+", GUINode.float_to_string_dp_dynamic(balance)]
# TODO - set strata tax and debt charts
# TODO - update sliders to reflect changes in limits
diff --git a/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
index ad15fbb..e078934 100644
--- a/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
@@ -14,8 +14,8 @@ var _province_list_types : Array[MenuSingleton.ProvinceListEntry]
var _province_list_indices : PackedInt32Array
var _province_list_panels : Array[Panel]
var _province_list_button_icons : Array[GFXSpriteTexture]
-var _province_list_name_labels : Array[Label]
-var _province_list_size_labels : Array[Label]
+var _province_list_name_labels : Array[GUILabel]
+var _province_list_size_labels : Array[GUILabel]
var _province_list_growth_icons : Array[GFXSpriteTexture]
var _province_list_colony_buttons : Array[Button]
var _province_list_national_focus_icons : Array[GFXSpriteTexture]
@@ -33,19 +33,19 @@ var _pop_list_scrollbar : GUIScrollbar
var _pop_list_scroll_index : int = 0
var _pop_list_rows : Array[Panel]
-var _pop_list_size_labels : Array[Label]
+var _pop_list_size_labels : Array[GUILabel]
var _pop_list_type_buttons : Array[Button]
var _pop_list_type_icons : Array[GFXSpriteTexture]
var _pop_list_producing_icons : Array[GFXSpriteTexture]
-var _pop_list_culture_labels : Array[Label]
+var _pop_list_culture_labels : Array[GUILabel]
var _pop_list_religion_icons : Array[GFXSpriteTexture]
-var _pop_list_location_labels : Array[Label]
-var _pop_list_militancy_labels : Array[Label]
-var _pop_list_consciousness_labels : Array[Label]
+var _pop_list_location_labels : Array[GUILabel]
+var _pop_list_militancy_labels : Array[GUILabel]
+var _pop_list_consciousness_labels : Array[GUILabel]
var _pop_list_ideology_charts : Array[GFXPieChartTexture]
var _pop_list_issues_charts : Array[GFXPieChartTexture]
var _pop_list_unemployment_progressbars : Array[TextureProgressBar]
-var _pop_list_cash_labels : Array[Label]
+var _pop_list_cash_labels : Array[GUILabel]
var _pop_list_life_needs_progressbars : Array[TextureProgressBar]
var _pop_list_everyday_needs_progressbars : Array[TextureProgressBar]
var _pop_list_luxury_needs_progressbars : Array[TextureProgressBar]
@@ -58,7 +58,7 @@ var _pop_list_political_movement_icons : Array[GFXSpriteTexture]
var _pop_list_national_movement_texture_rects : Array[TextureRect]
var _pop_list_national_movement_flags : Array[GFXMaskedFlagTexture]
var _pop_list_size_change_icons : Array[GFXSpriteTexture]
-var _pop_list_literacy_labels : Array[Label]
+var _pop_list_literacy_labels : Array[GUILabel]
func _ready() -> void:
GameSingleton.gamestate_updated.connect(_update_info)
@@ -142,9 +142,9 @@ func _generate_province_list_row(index : int, type : MenuSingleton.ProvinceListE
)
_province_list_button_icons[index] = GUINode.get_gfx_sprite_texture_from_node(base_button)
- _province_list_name_labels[index] = GUINode.get_label_from_node(entry_panel.get_node(^"./poplist_name"))
+ _province_list_name_labels[index] = GUINode.get_gui_label_from_node(entry_panel.get_node(^"./poplist_name"))
- _province_list_size_labels[index] = GUINode.get_label_from_node(entry_panel.get_node(^"./poplist_numpops"))
+ _province_list_size_labels[index] = GUINode.get_gui_label_from_node(entry_panel.get_node(^"./poplist_numpops"))
_province_list_growth_icons[index] = GUINode.get_gfx_sprite_texture_from_node(entry_panel.get_node(^"./growth_indicator"))
@@ -273,9 +273,9 @@ func _setup_distribution_windows() -> void:
_pop_screen_panel.add_child(distribution_panel)
distribution_panel.set_position(distribution_start + distribution_step * Vector2(index % columns, index / columns))
- var name_label : Label = GUINode.get_label_from_node(distribution_panel.get_node(^"./item_name"))
+ var name_label : GUILabel = GUINode.get_gui_label_from_node(distribution_panel.get_node(^"./item_name"))
if name_label:
- name_label.text = distribution_names[index]
+ name_label.set_text(distribution_names[index])
distribution_chart = GUINode.get_gfx_pie_chart_texture_from_node(distribution_panel.get_node(^"./chart"))
distribution_list = GUINode.get_gui_listbox_from_node(distribution_panel.get_node(^"./member_names"))
@@ -318,7 +318,7 @@ func _setup_pop_list() -> void:
height += pop_row_panel.size.y
_pop_list_rows.push_back(pop_row_panel)
- _pop_list_size_labels.push_back(GUINode.get_label_from_node(pop_row_panel.get_node(^"./pop_size")))
+ _pop_list_size_labels.push_back(GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_size")))
var pop_type_button : Button = GUINode.get_button_from_node(pop_row_panel.get_node(^"./pop_type"))
# TODO - open pop details menu on pop type button press
@@ -328,21 +328,17 @@ func _setup_pop_list() -> void:
_pop_list_producing_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_row_panel.get_node(^"./pop_producing_icon")))
- var culture_label : Label = GUINode.get_label_from_node(pop_row_panel.get_node(^"./pop_nation"))
- if culture_label:
- culture_label.set_text_overrun_behavior(TextServer.OVERRUN_TRIM_ELLIPSIS)
+ var culture_label : GUILabel = GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_nation"))
_pop_list_culture_labels.push_back(culture_label)
_pop_list_religion_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_row_panel.get_node(^"./pop_religion")))
- var location_label : Label = GUINode.get_label_from_node(pop_row_panel.get_node(^"./pop_location"))
- if location_label:
- location_label.set_text_overrun_behavior(TextServer.OVERRUN_TRIM_ELLIPSIS)
+ var location_label : GUILabel = GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_location"))
_pop_list_location_labels.push_back(location_label)
- _pop_list_militancy_labels.push_back(GUINode.get_label_from_node(pop_row_panel.get_node(^"./pop_mil")))
+ _pop_list_militancy_labels.push_back(GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_mil")))
- _pop_list_consciousness_labels.push_back(GUINode.get_label_from_node(pop_row_panel.get_node(^"./pop_con")))
+ _pop_list_consciousness_labels.push_back(GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_con")))
_pop_list_ideology_charts.push_back(GUINode.get_gfx_pie_chart_texture_from_node(pop_row_panel.get_node(^"./pop_ideology")))
@@ -350,7 +346,7 @@ func _setup_pop_list() -> void:
_pop_list_unemployment_progressbars.push_back(GUINode.get_progress_bar_from_node(pop_row_panel.get_node(^"./pop_unemployment_bar")))
- _pop_list_cash_labels.push_back(GUINode.get_label_from_node(pop_row_panel.get_node(^"./pop_cash")))
+ _pop_list_cash_labels.push_back(GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_cash")))
var pop_list_life_needs_progressbar : TextureProgressBar = GUINode.get_progress_bar_from_node(pop_row_panel.get_node(^"./lifeneed_progress"))
if pop_list_life_needs_progressbar:
@@ -394,7 +390,7 @@ func _setup_pop_list() -> void:
_pop_list_size_change_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_row_panel.get_node(^"./growth_indicator")))
- _pop_list_literacy_labels.push_back(GUINode.get_label_from_node(pop_row_panel.get_node(^"./pop_literacy")))
+ _pop_list_literacy_labels.push_back(GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_literacy")))
func _notification(what : int) -> void:
match what:
@@ -462,7 +458,6 @@ func _update_province_list(scroll_index : int = -1) -> void:
GUINode.format_province_name(province_list_info[name_key]) if type == MenuSingleton.LIST_ENTRY_PROVINCE
else province_list_info[name_key]
)
- _province_list_name_labels[index].set_text_overrun_behavior(TextServer.OVERRUN_TRIM_ELLIPSIS)
if _province_list_size_labels[index]:
_province_list_size_labels[index].set_text(GUINode.int_to_string_suffixed(province_list_info[size_key]))
@@ -551,12 +546,11 @@ func _update_distributions():
if colour_icon_rect:
colour_icon_rect.set_modulate(distribution_row[slice_colour_key])
- var identifier_label : Label = GUINode.get_label_from_node(child.get_node(^"./legend_title"))
+ var identifier_label : GUILabel = GUINode.get_gui_label_from_node(child.get_node(^"./legend_title"))
if identifier_label:
- identifier_label.set_text_overrun_behavior(TextServer.OVERRUN_TRIM_ELLIPSIS)
identifier_label.set_text(distribution_row[slice_identifier_key])
- var weight_label : Label = GUINode.get_label_from_node(child.get_node(^"./legend_value"))
+ var weight_label : GUILabel = GUINode.get_gui_label_from_node(child.get_node(^"./legend_value"))
if weight_label:
weight_label.set_text("%s%%" % GUINode.float_to_string_dp(distribution_row[slice_weight_key] * 100.0, 1))
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel.gd b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
index 864c0e5..f2669c0 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel.gd
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
@@ -1,13 +1,13 @@
extends GUINode
# Header
-var _province_name_label : Label
-var _state_name_label : Label
+var _province_name_label : GUILabel
+var _state_name_label : GUILabel
var _slave_status_icon : TextureRect
var _colony_status_button : Button
var _colony_status_button_texture : GFXSpriteTexture
-var _administrative_percentage_label : Label
-var _owner_percentage_label : Label
+var _administrative_percentage_label : GUILabel
+var _owner_percentage_label : GUILabel
var _province_modifiers_overlapping_elements_box : GUIOverlappingElementsBox
var _terrain_type_texture : GFXSpriteTexture
var _life_rating_bar : TextureProgressBar
@@ -15,21 +15,21 @@ var _controller_flag_texture : GFXMaskedFlagTexture
# Statistics
var _rgo_icon_texture : GFXSpriteTexture
-var _rgo_produced_label : Label
-var _rgo_income_label : Label
+var _rgo_produced_label : GUILabel
+var _rgo_income_label : GUILabel
var _rgo_employment_percentage_texture : GFXSpriteTexture
-var _rgo_employment_population_label : Label
-var _rgo_employment_percentage_label : Label
-var _crime_name_label : Label
+var _rgo_employment_population_label : GUILabel
+var _rgo_employment_percentage_label : GUILabel
+var _crime_name_label : GUILabel
var _crime_icon_texture : GFXSpriteTexture
-var _crime_fighting_label : Label
-var _total_population_label : Label
-var _migration_label : Label
-var _population_growth_label : Label
+var _crime_fighting_label : GUILabel
+var _total_population_label : GUILabel
+var _migration_label : GUILabel
+var _population_growth_label : GUILabel
var _pop_types_piechart : GFXPieChartTexture
var _pop_ideologies_piechart : GFXPieChartTexture
var _pop_cultures_piechart : GFXPieChartTexture
-var _supply_limit_label : Label
+var _supply_limit_label : GUILabel
var _cores_overlapping_elements_box : GUIOverlappingElementsBox
# Buildings
@@ -48,7 +48,7 @@ class BuildingSlot:
var _expand_button : Button
var _expanding_icon : TextureRect
var _expanding_progress_bar : TextureProgressBar
- var _expanding_label : Label
+ var _expanding_label : GUILabel
func _init(new_slot_index : int, new_slot_node : Control) -> void:
if new_slot_index < 0:
@@ -68,7 +68,7 @@ class BuildingSlot:
else:
icon.hide()
- var building_name := GUINode.get_label_from_node(_slot_node.get_node(^"./description"))
+ var building_name := GUINode.get_gui_label_from_node(_slot_node.get_node(^"./description"))
if building_name:
building_name.text = MenuSingleton.get_province_building_identifier(_slot_index)
_expand_button = GUINode.get_button_from_node(_slot_node.get_node(^"./expand"))
@@ -79,7 +79,7 @@ class BuildingSlot:
if _expanding_progress_bar:
_expanding_progress_bar.max_value = 1.0
_expanding_progress_bar.step = _expanding_progress_bar.max_value / 100
- _expanding_label = GUINode.get_label_from_node(_slot_node.get_node(^"./expand_text"))
+ _expanding_label = GUINode.get_gui_label_from_node(_slot_node.get_node(^"./expand_text"))
enum ExpansionState { CannotExpand, CanExpand, Preparing, Expanding }
@@ -136,8 +136,8 @@ func _ready() -> void:
close_button.pressed.connect(_on_close_button_pressed)
# Header
- _province_name_label = get_label_from_nodepath(^"./province_view/province_view_header/province_name")
- _state_name_label = get_label_from_nodepath(^"./province_view/province_view_header/state_name")
+ _province_name_label = get_gui_label_from_nodepath(^"./province_view/province_view_header/province_name")
+ _state_name_label = get_gui_label_from_nodepath(^"./province_view/province_view_header/state_name")
if _state_name_label:
# State names are already translated in the MenuSingleton
_state_name_label.auto_translate = false
@@ -150,8 +150,8 @@ func _ready() -> void:
var admin_icon_texture : GFXSpriteTexture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_view_header/admin_icon")
if admin_icon_texture:
admin_icon_texture.set_icon_index(MenuSingleton.get_administrative_pop_icon_index())
- _administrative_percentage_label = get_label_from_nodepath(^"./province_view/province_view_header/admin_efficiency")
- _owner_percentage_label = get_label_from_nodepath(^"./province_view/province_view_header/owner_presence")
+ _administrative_percentage_label = get_gui_label_from_nodepath(^"./province_view/province_view_header/admin_efficiency")
+ _owner_percentage_label = get_gui_label_from_nodepath(^"./province_view/province_view_header/owner_presence")
_province_modifiers_overlapping_elements_box = get_gui_overlapping_elements_box_from_nodepath(^"./province_view/province_view_header/province_modifiers")
if _province_modifiers_overlapping_elements_box and _province_modifiers_overlapping_elements_box.set_gui_child_element_name("province_interface", "prov_state_modifier") != OK:
_province_modifiers_overlapping_elements_box = null # hide province modifiers box since we can't do anything with it
@@ -161,17 +161,17 @@ func _ready() -> void:
# Statistics
_rgo_icon_texture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_statistics/goods_type")
- _rgo_produced_label = get_label_from_nodepath(^"./province_view/province_statistics/produced")
- _rgo_income_label = get_label_from_nodepath(^"./province_view/province_statistics/income")
+ _rgo_produced_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/produced")
+ _rgo_income_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/income")
_rgo_employment_percentage_texture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_statistics/employment_ratio")
- _rgo_employment_population_label = get_label_from_nodepath(^"./province_view/province_statistics/rgo_population")
- _rgo_employment_percentage_label = get_label_from_nodepath(^"./province_view/province_statistics/rgo_percent")
- _crime_name_label = get_label_from_nodepath(^"./province_view/province_statistics/crime_name")
+ _rgo_employment_population_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/rgo_population")
+ _rgo_employment_percentage_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/rgo_percent")
+ _crime_name_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/crime_name")
_crime_icon_texture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_statistics/crime_icon")
- _crime_fighting_label = get_label_from_nodepath(^"./province_view/province_statistics/crimefight_percent")
- _total_population_label = get_label_from_nodepath(^"./province_view/province_statistics/total_population")
- _migration_label = get_label_from_nodepath(^"./province_view/province_statistics/migration")
- _population_growth_label = get_label_from_nodepath(^"./province_view/province_statistics/growth")
+ _crime_fighting_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/crimefight_percent")
+ _total_population_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/total_population")
+ _migration_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/migration")
+ _population_growth_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/growth")
_pop_types_piechart = get_gfx_pie_chart_texture_from_nodepath(^"./province_view/province_statistics/workforce_chart")
_pop_ideologies_piechart = get_gfx_pie_chart_texture_from_nodepath(^"./province_view/province_statistics/ideology_chart")
_pop_cultures_piechart = get_gfx_pie_chart_texture_from_nodepath(^"./province_view/province_statistics/culture_chart")
@@ -183,7 +183,7 @@ func _ready() -> void:
_on_close_button_pressed()
Events.NationManagementScreens.open_nation_management_screen(NationManagement.Screen.POPULATION)
)
- _supply_limit_label = get_label_from_nodepath(^"./province_view/province_statistics/supply_limit_label")
+ _supply_limit_label = get_gui_label_from_nodepath(^"./province_view/province_statistics/supply_limit_label")
_cores_overlapping_elements_box = get_gui_overlapping_elements_box_from_nodepath(^"./province_view/province_statistics/core_icons")
if _cores_overlapping_elements_box and _cores_overlapping_elements_box.set_gui_child_element_name("province_interface", "province_core") != OK:
_cores_overlapping_elements_box = null # hide cores box since we can't do anything with it
@@ -314,7 +314,7 @@ func _update_info() -> void:
if _rgo_income_label:
# TODO - add £ sign and replace placeholder with actual value
- _rgo_income_label.text = "%s £" % GUINode.float_to_string_dp(12.34567, 3)
+ _rgo_income_label.text = "%s¤" % GUINode.float_to_string_dp(12.34567, 3)
if _rgo_employment_percentage_texture:
pass
diff --git a/game/src/Game/GameSession/Topbar.gd b/game/src/Game/GameSession/Topbar.gd
index c1fde1c..d6cc358 100644
--- a/game/src/Game/GameSession/Topbar.gd
+++ b/game/src/Game/GameSession/Topbar.gd
@@ -3,21 +3,21 @@ extends GUINode
# Country info
var _country_flag_texture : GFXMaskedFlagTexture
var _country_flag_overlay_texture : GFXSpriteTexture
-var _country_name_label : Label
-var _country_rank_label : Label
-var _country_prestige_label : Label
-var _country_prestige_rank_label : Label
-var _country_industrial_power_label : Label
-var _country_industrial_power_rank_label : Label
-var _country_military_power_label : Label
-var _country_military_power_rank_label : Label
-var _country_colonial_power_label : Label
+var _country_name_label : GUILabel
+var _country_rank_label : GUILabel
+var _country_prestige_label : GUILabel
+var _country_prestige_rank_label : GUILabel
+var _country_industrial_power_label : GUILabel
+var _country_industrial_power_rank_label : GUILabel
+var _country_military_power_label : GUILabel
+var _country_military_power_rank_label : GUILabel
+var _country_colonial_power_label : GUILabel
# Time controls
var _speed_up_button : Button
var _speed_down_button : Button
var _speed_indicator_texture : GFXSpriteTexture
-var _date_label : Label
+var _date_label : GUILabel
# NationManagement.Screen-Button
var _nation_management_buttons : Dictionary
@@ -32,53 +32,48 @@ var _production_alert_unemployment_texture : GFXSpriteTexture
# Budget
# TODO - line chart
-var _budget_funds_label : Label
+var _budget_funds_label : GUILabel
# Technology
var _technology_progress_bar : TextureProgressBar
-var _technology_current_research_label : Label
-var _technology_literacy_label : Label
-var _technology_research_points_label : Label
+var _technology_current_research_label : GUILabel
+var _technology_literacy_label : GUILabel
+var _technology_research_points_label : GUILabel
# Politics
var _politics_party_icon : TextureRect
-var _politics_party_label : Label
-var _politics_suppression_points_label : Label
-var _politics_infamy_label : Label
+var _politics_party_label : GUILabel
+var _politics_suppression_points_label : GUILabel
+var _politics_infamy_label : GUILabel
var _politics_reforms_texture : GFXSpriteTexture
var _politics_decisions_texture : GFXSpriteTexture
var _politics_election_texture : GFXSpriteTexture
var _politics_rebels_texture : GFXSpriteTexture
# Population
-var _population_total_size_label : Label
-var _population_national_foci_label : Label
-var _population_militancy_label : Label
-var _population_consciousness_label : Label
+var _population_total_size_label : GUILabel
+var _population_national_foci_label : GUILabel
+var _population_militancy_label : GUILabel
+var _population_consciousness_label : GUILabel
# Trade
var _trade_imported_textures : Array[GFXSpriteTexture]
var _trade_exported_textures : Array[GFXSpriteTexture]
# Diplomacy
-var _diplomacy_peace_label : Label
+var _diplomacy_peace_label : GUILabel
var _diplomacy_war_enemies_overlapping_elements_box : GUIOverlappingElementsBox
-var _diplomacy_diplomatic_points_label : Label
+var _diplomacy_diplomatic_points_label : GUILabel
var _diplomacy_alert_colony_texture : GFXSpriteTexture
var _diplomacy_alert_crisis_texture : GFXSpriteTexture
var _diplomacy_alert_sphere_texture : GFXSpriteTexture
var _diplomacy_alert_great_power_texture : GFXSpriteTexture
# Military
-var _military_army_size_label : Label
-var _military_navy_size_label : Label
-var _military_mobilisation_size_label : Label
-var _military_leadership_points_label : Label
-
-# TODO - use GFX file font colour codes
-const FONT_GREEN : Color = Color("009F03")
-const FONT_RED : Color = Color("FF3232")
-const FONT_YELLOW : Color = Color("FFBD00")
+var _military_army_size_label : GUILabel
+var _military_navy_size_label : GUILabel
+var _military_mobilisation_size_label : GUILabel
+var _military_leadership_points_label : GUILabel
func _ready() -> void:
GameSingleton.gamestate_updated.connect(_update_info)
@@ -107,15 +102,15 @@ func _ready() -> void:
)
_country_flag_texture = GUINode.get_gfx_masked_flag_texture_from_node(country_flag_button)
_country_flag_overlay_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/topbar_flag_overlay")
- _country_name_label = get_label_from_nodepath(^"./topbar/CountryName")
- _country_rank_label = get_label_from_nodepath(^"./topbar/nation_totalrank")
- _country_prestige_label = get_label_from_nodepath(^"./topbar/country_prestige")
- _country_prestige_rank_label = get_label_from_nodepath(^"./topbar/selected_prestige_rank")
- _country_industrial_power_label = get_label_from_nodepath(^"./topbar/country_economic")
- _country_industrial_power_rank_label = get_label_from_nodepath(^"./topbar/selected_industry_rank")
- _country_military_power_label = get_label_from_nodepath(^"./topbar/country_military")
- _country_military_power_rank_label = get_label_from_nodepath(^"./topbar/selected_military_rank")
- _country_colonial_power_label = get_label_from_nodepath(^"./topbar/country_colonial_power")
+ _country_name_label = get_gui_label_from_nodepath(^"./topbar/CountryName")
+ _country_rank_label = get_gui_label_from_nodepath(^"./topbar/nation_totalrank")
+ _country_prestige_label = get_gui_label_from_nodepath(^"./topbar/country_prestige")
+ _country_prestige_rank_label = get_gui_label_from_nodepath(^"./topbar/selected_prestige_rank")
+ _country_industrial_power_label = get_gui_label_from_nodepath(^"./topbar/country_economic")
+ _country_industrial_power_rank_label = get_gui_label_from_nodepath(^"./topbar/selected_industry_rank")
+ _country_military_power_label = get_gui_label_from_nodepath(^"./topbar/country_military")
+ _country_military_power_rank_label = get_gui_label_from_nodepath(^"./topbar/selected_military_rank")
+ _country_colonial_power_label = get_gui_label_from_nodepath(^"./topbar/country_colonial_power")
# Time controls
_speed_up_button = get_button_from_nodepath(^"./topbar/button_speedup")
@@ -131,7 +126,7 @@ func _ready() -> void:
if speed_indicator_button:
speed_indicator_button.pressed.connect(_on_play_pause_button_pressed)
_speed_indicator_texture = GUINode.get_gfx_sprite_texture_from_node(speed_indicator_button)
- _date_label = get_label_from_nodepath(^"./topbar/DateText")
+ _date_label = get_gui_label_from_nodepath(^"./topbar/DateText")
# Nation management screens
const screen_nodepaths : Dictionary = {
@@ -167,21 +162,17 @@ func _ready() -> void:
_production_alert_unemployment_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/alert_unemployed_workers")
# Budget
- _budget_funds_label = get_label_from_nodepath(^"./topbar/budget_funds")
+ _budget_funds_label = get_gui_label_from_nodepath(^"./topbar/budget_funds")
# Technology
_technology_progress_bar = get_progress_bar_from_nodepath(^"./topbar/topbar_tech_progress")
- _technology_current_research_label = get_label_from_nodepath(^"./topbar/tech_current_research")
- _technology_literacy_label = get_label_from_nodepath(^"./topbar/tech_literacy_value")
- if _technology_literacy_label:
- _technology_literacy_label.add_theme_color_override(&"font_color", FONT_YELLOW)
- _technology_research_points_label = get_label_from_nodepath(^"./topbar/topbar_researchpoints_value")
- if _technology_research_points_label:
- _technology_research_points_label.add_theme_color_override(&"font_color", FONT_YELLOW)
+ _technology_current_research_label = get_gui_label_from_nodepath(^"./topbar/tech_current_research")
+ _technology_literacy_label = get_gui_label_from_nodepath(^"./topbar/tech_literacy_value")
+ _technology_research_points_label = get_gui_label_from_nodepath(^"./topbar/topbar_researchpoints_value")
# Politics
_politics_party_icon = get_texture_rect_from_nodepath(^"./topbar/politics_party_icon")
- _politics_party_label = get_label_from_nodepath(^"./topbar/politics_ruling_party")
+ _politics_party_label = get_gui_label_from_nodepath(^"./topbar/politics_ruling_party")
var politics_suppression_button : Button = get_button_from_nodepath(^"./topbar/topbar_supression_icon")
if politics_suppression_button:
politics_suppression_button.pressed.connect(
@@ -189,12 +180,8 @@ func _ready() -> void:
# TODO - open the politics menu on the Movements tab
Events.NationManagementScreens.toggle_nation_management_screen(NationManagement.Screen.POLITICS)
)
- _politics_suppression_points_label = get_label_from_nodepath(^"./topbar/politics_supressionpoints_value")
- if _politics_suppression_points_label:
- _politics_suppression_points_label.add_theme_color_override(&"font_color", FONT_YELLOW)
- _politics_infamy_label = get_label_from_nodepath(^"./topbar/politics_infamy_value")
- if _politics_infamy_label:
- _politics_infamy_label.add_theme_color_override(&"font_color", FONT_YELLOW)
+ _politics_suppression_points_label = get_gui_label_from_nodepath(^"./topbar/politics_supressionpoints_value")
+ _politics_infamy_label = get_gui_label_from_nodepath(^"./topbar/politics_infamy_value")
var politics_reforms_button : Button = get_button_from_nodepath(^"./topbar/alert_can_do_reforms")
if politics_reforms_button:
politics_reforms_button.pressed.connect(
@@ -222,14 +209,10 @@ func _ready() -> void:
_politics_rebels_texture = GUINode.get_gfx_sprite_texture_from_node(politics_rebels_button)
# Population
- _population_total_size_label = get_label_from_nodepath(^"./topbar/population_total_value")
- _population_national_foci_label = get_label_from_nodepath(^"./topbar/topbar_focus_value")
- _population_militancy_label = get_label_from_nodepath(^"./topbar/population_avg_mil_value")
- if _population_militancy_label:
- _population_militancy_label.add_theme_color_override(&"font_color", FONT_YELLOW)
- _population_consciousness_label = get_label_from_nodepath(^"./topbar/population_avg_con_value")
- if _population_consciousness_label:
- _population_consciousness_label.add_theme_color_override(&"font_color", FONT_YELLOW)
+ _population_total_size_label = get_gui_label_from_nodepath(^"./topbar/population_total_value")
+ _population_national_foci_label = get_gui_label_from_nodepath(^"./topbar/topbar_focus_value")
+ _population_militancy_label = get_gui_label_from_nodepath(^"./topbar/population_avg_mil_value")
+ _population_consciousness_label = get_gui_label_from_nodepath(^"./topbar/population_avg_con_value")
# Trade
const TRADE_GOOD_COUNT : int = 3
@@ -238,11 +221,9 @@ func _ready() -> void:
_trade_exported_textures.push_back(get_gfx_sprite_texture_from_nodepath("./topbar/topbar_export%d" % idx))
# Diplomacy
- _diplomacy_peace_label = get_label_from_nodepath(^"./topbar/diplomacy_status")
+ _diplomacy_peace_label = get_gui_label_from_nodepath(^"./topbar/diplomacy_status")
_diplomacy_war_enemies_overlapping_elements_box = get_gui_overlapping_elements_box_from_nodepath(^"./topbar/diplomacy_at_war")
- _diplomacy_diplomatic_points_label = get_label_from_nodepath(^"./topbar/diplomacy_diplopoints_value")
- if _diplomacy_diplomatic_points_label:
- _diplomacy_diplomatic_points_label.add_theme_color_override(&"font_color", FONT_YELLOW)
+ _diplomacy_diplomatic_points_label = get_gui_label_from_nodepath(^"./topbar/diplomacy_diplopoints_value")
var diplomacy_alert_colony_button : Button = get_button_from_nodepath(^"./topbar/alert_colony")
if diplomacy_alert_colony_button:
diplomacy_alert_colony_button.pressed.connect(
@@ -256,18 +237,10 @@ func _ready() -> void:
_diplomacy_alert_great_power_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/alert_loosing_gp")
# Military
- _military_army_size_label = get_label_from_nodepath(^"./topbar/military_army_value")
- if _military_army_size_label:
- _military_army_size_label.add_theme_color_override(&"font_color", FONT_YELLOW)
- _military_navy_size_label = get_label_from_nodepath(^"./topbar/military_navy_value")
- if _military_navy_size_label:
- _military_navy_size_label.add_theme_color_override(&"font_color", FONT_YELLOW)
- _military_mobilisation_size_label = get_label_from_nodepath(^"./topbar/military_manpower_value")
- if _military_mobilisation_size_label:
- _military_mobilisation_size_label.add_theme_color_override(&"font_color", FONT_YELLOW)
- _military_leadership_points_label = get_label_from_nodepath(^"./topbar/military_leadership_value")
- if _military_leadership_points_label:
- _military_leadership_points_label.add_theme_color_override(&"font_color", FONT_YELLOW)
+ _military_army_size_label = get_gui_label_from_nodepath(^"./topbar/military_army_value")
+ _military_navy_size_label = get_gui_label_from_nodepath(^"./topbar/military_navy_value")
+ _military_mobilisation_size_label = get_gui_label_from_nodepath(^"./topbar/military_manpower_value")
+ _military_leadership_points_label = get_gui_label_from_nodepath(^"./topbar/military_leadership_value")
_update_info()
_update_speed_controls()
@@ -296,8 +269,7 @@ func _update_info() -> void:
_country_name_label.set_text(player_country)
if _country_rank_label:
- # TODO - fix label alignment
- _country_rank_label.set_text(" %d" % 1)
+ _country_rank_label.set_text(str(1))
if _country_prestige_label:
_country_prestige_label.set_text(str(11))
@@ -318,8 +290,11 @@ func _update_info() -> void:
_country_military_power_rank_label.set_text(str(3))
if _country_colonial_power_label:
- # TODO - colour (first number is red if non-positive)
- _country_colonial_power_label.set_text("%s/%s" % [123, 456])
+ var available_colonial_power : int = 123
+ var total_colonial_power : int = 456
+ _country_colonial_power_label.set_text(
+ "§%s%s§!/%s" % ["W" if available_colonial_power > 0 else "R", available_colonial_power, total_colonial_power]
+ )
## Time control
if _date_label:
@@ -343,13 +318,11 @@ func _update_info() -> void:
if _budget_funds_label:
var cash : float = 0.0
var earnings : float = 0.0
- _budget_funds_label.set_text("%s £ (%s%s £ )" % [
+ _budget_funds_label.set_text("§Y%s§!¤(§%s%s§!¤)" % [
GUINode.float_to_string_suffixed(cash),
- "+" if earnings >= 0.0 else "",
+ "G+" if earnings > 0.0 else "R" if earnings < 0.0 else "Y+",
GUINode.float_to_string_suffixed(earnings)
])
- # TODO - set colours: cash yellow, earnings red (-), yellow (0) or green (+)
- _budget_funds_label.add_theme_color_override(&"font_color", FONT_YELLOW)
## Technology
if _technology_progress_bar:
@@ -357,26 +330,13 @@ func _update_info() -> void:
if _technology_current_research_label:
# TODO - set current research or "unciv_nation" (in red) if uncivilised
- # TODO - process colour markers in localisation for "TB_TECH_NO_CURRENT"
-
- # Remove § symbols + colour codes from string
- var no_research : String = tr("TB_TECH_NO_CURRENT")
- while true:
- const COLOUR_CHAR : String = "\u00A7"
- var pos : int = no_research.find(COLOUR_CHAR)
- if pos >= 0:
- no_research = no_research.erase(pos, 2)
- else:
- break
-
- _technology_current_research_label.set_text(no_research)
- _technology_current_research_label.add_theme_color_override(&"font_color", FONT_RED)
+ _technology_current_research_label.set_text("TB_TECH_NO_CURRENT")
if _technology_literacy_label:
- _technology_literacy_label.set_text("%s%%" % GUINode.float_to_string_dp(80.0, 1))
+ _technology_literacy_label.set_text("§Y%s§W%%" % GUINode.float_to_string_dp(80.0, 1))
if _technology_research_points_label:
- _technology_research_points_label.set_text(GUINode.float_to_string_dp(10.0, 2))
+ _technology_research_points_label.set_text("§Y%s" % GUINode.float_to_string_dp(10.0, 2))
## Politics
if _politics_party_icon:
@@ -386,10 +346,10 @@ func _update_info() -> void:
_politics_party_label.set_text("ENG_liberal")
if _politics_suppression_points_label:
- _politics_suppression_points_label.set_text(GUINode.float_to_string_dp(2.5, 1))
+ _politics_suppression_points_label.set_text("§Y%s" % GUINode.float_to_string_dp(2.5, 1))
if _politics_infamy_label:
- _politics_infamy_label.set_text(GUINode.float_to_string_dp(0.0, 2))
+ _politics_infamy_label.set_text("§Y%s" % GUINode.float_to_string_dp(0.0, 2))
if _politics_reforms_texture:
_politics_reforms_texture.set_icon_index(2)
@@ -405,25 +365,25 @@ func _update_info() -> void:
## Population
if _population_total_size_label:
- _population_total_size_label.set_text("%s(%s)" % [
- GUINode.int_to_string_suffixed(16000000),
- GUINode.int_to_string_suffixed(1500),
+ # TODO - suffixes on both numbers should be white!
+ var total_population : int = 16000000
+ var growth : int = 1500
+ _population_total_size_label.set_text("§Y%s§!(§%s%s§!)" % [
+ GUINode.int_to_string_suffixed(total_population),
+ "G" if growth >= 0 else "R",
+ GUINode.int_to_string_suffixed(growth),
])
- # TODO - set colours: yellow total population number, green or red change number (both numbers with a white suffix!)
- _population_total_size_label.add_theme_color_override(&"font_color", FONT_YELLOW)
-
if _population_national_foci_label:
var foci_used : int = 1
var max_foci : int = 1
- _population_national_foci_label.set_text("%d/%d" % [foci_used, max_foci])
- _population_national_foci_label.add_theme_color_override(&"font_color", FONT_RED if foci_used < max_foci else FONT_GREEN)
+ _population_national_foci_label.set_text("§%s%d/%d" % ["R" if foci_used < max_foci else "G", foci_used, max_foci])
if _population_militancy_label:
- _population_militancy_label.set_text(GUINode.float_to_string_dp(1.5, 2))
+ _population_militancy_label.set_text("§Y%s" % GUINode.float_to_string_dp(1.5, 2))
if _population_consciousness_label:
- _population_consciousness_label.set_text(GUINode.float_to_string_dp(0.05, 2))
+ _population_consciousness_label.set_text("§Y%s" % GUINode.float_to_string_dp(0.05, 2))
## Trade
for idx : int in _trade_imported_textures.size():
@@ -441,7 +401,7 @@ func _update_info() -> void:
# TODO - add war enemy flags to _diplomacy_war_enemies_overlapping_elements_box
if _diplomacy_diplomatic_points_label:
- _diplomacy_diplomatic_points_label.set_text(GUINode.float_to_string_dp(7.4, 0))
+ _diplomacy_diplomatic_points_label.set_text("§Y%s" % GUINode.float_to_string_dp(7.4, 0))
if _diplomacy_alert_colony_texture:
_diplomacy_alert_colony_texture.set_icon_index(3)
@@ -457,16 +417,16 @@ func _update_info() -> void:
## Military
if _military_army_size_label:
- _military_army_size_label.set_text("%d/%d" % [57, 120])
+ _military_army_size_label.set_text("§Y%d/%d" % [57, 120])
if _military_navy_size_label:
- _military_navy_size_label.set_text("%d/%d" % [123, 267])
+ _military_navy_size_label.set_text("§Y%d/%d" % [123, 267])
if _military_mobilisation_size_label:
- _military_mobilisation_size_label.set_text(str(38))
+ _military_mobilisation_size_label.set_text("§Y%d" % 38)
if _military_leadership_points_label:
- _military_leadership_points_label.set_text(str(15))
+ _military_leadership_points_label.set_text("§Y%d" % 15)
func _update_speed_controls() -> void:
# TODO - decide whether to disable these or not
diff --git a/game/src/Game/GameStart.gd b/game/src/Game/GameStart.gd
index 3c046a0..837e712 100644
--- a/game/src/Game/GameStart.gd
+++ b/game/src/Game/GameStart.gd
@@ -112,7 +112,7 @@ func _load_compatibility_mode() -> void:
if GameSingleton.load_defines_compatibility_mode() != OK:
push_error("Errors loading game defines!")
-
+
SoundSingleton.load_sounds()
SoundSingleton.load_music()
MusicConductor.add_compat_songs()
@@ -130,7 +130,6 @@ func setup_title_theme() -> void:
push_error("No song available to play")
else:
MusicConductor.call_deferred("start_current_song")
-
# REQUIREMENTS
# * FS-333, FS-334, FS-335, FS-341