aboutsummaryrefslogtreecommitdiff
path: root/game/src
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-08-28 19:46:30 +0200
committer hop311 <hop3114@gmail.com>2024-08-28 23:51:31 +0200
commit88acb31bd43f0e163522837bb1d0dd7da2977c4a (patch)
tree241cbf8cf21a7cdfe1c870469ac3b3ef3064bdb3 /game/src
parentd7672f406406eea46625bc725690651f28211e19 (diff)
Switch to using custom UI nodes
Diffstat (limited to 'game/src')
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd30
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd2
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd2
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd2
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd192
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd2
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd2
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd2
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel.gd110
-rw-r--r--game/src/Game/GameSession/SearchPanel.gd8
-rw-r--r--game/src/Game/GameSession/Topbar.gd209
11 files changed, 257 insertions, 304 deletions
diff --git a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
index 20eb198..ea92beb 100644
--- a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
@@ -35,10 +35,10 @@ var _tariff_val_label : GUILabel
var _diplomatic_balance_label : GUILabel
var _balance_label : GUILabel
-var _lower_class_chart : GFXPieChartTexture
-var _middle_class_chart : GFXPieChartTexture
-var _upper_class_chart : GFXPieChartTexture
-var _debt_chart : GFXPieChartTexture
+var _lower_class_chart : GUIPieChart
+var _middle_class_chart : GUIPieChart
+var _upper_class_chart : GUIPieChart
+var _debt_chart : GUIPieChart
const _screen : NationManagement.Screen = NationManagement.Screen.BUDGET
@@ -49,7 +49,7 @@ func _ready() -> void:
add_gui_element("country_budget", "country_budget")
- var close_button : Button = get_button_from_nodepath(^"./country_budget/close_button")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_budget/close_button")
if close_button:
close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
@@ -144,30 +144,30 @@ func _ready() -> void:
_tariff_slider.emit_value_changed()
# debt buttons
- var _tab_takenloans_button : Button = get_button_from_nodepath(^"./country_budget/tab_takenloans")
+ var _tab_takenloans_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_budget/tab_takenloans")
if _tab_takenloans_button:
_tab_takenloans_button.pressed.connect(_switch_loans_tab.bind(true))
- var _tab_givenloans_button : Button = get_button_from_nodepath(^"./country_budget/tab_givenloans")
+ var _tab_givenloans_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_budget/tab_givenloans")
if _tab_givenloans_button:
_tab_givenloans_button.pressed.connect(_switch_loans_tab.bind(false))
- var _debt_sort_country_button : Button = get_button_from_nodepath(^"./country_budget/debt_sort_country")
+ var _debt_sort_country_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_budget/debt_sort_country")
if _debt_sort_country_button:
_debt_sort_country_button.pressed.connect(_sort_loans.bind(true))
- var _debt_sort_amount_button : Button = get_button_from_nodepath(^"./country_budget/debt_sort_amount")
+ var _debt_sort_amount_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_budget/debt_sort_amount")
if _debt_sort_amount_button:
_debt_sort_amount_button.pressed.connect(_sort_loans.bind(false))
- var _take_loan_button : Button = get_button_from_nodepath(^"./country_budget/take_loan")
+ var _take_loan_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_budget/take_loan")
if _take_loan_button:
_take_loan_button.pressed.connect(_take_loan)
- var _repay_loan_button : Button = get_button_from_nodepath(^"./country_budget/repay_loan")
+ var _repay_loan_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_budget/repay_loan")
if _repay_loan_button:
_repay_loan_button.pressed.connect(_repay_loan)
# charts
- _lower_class_chart = get_gfx_pie_chart_texture_from_nodepath(^"./country_budget/chart_0")
- _middle_class_chart = get_gfx_pie_chart_texture_from_nodepath(^"./country_budget/chart_1")
- _upper_class_chart = get_gfx_pie_chart_texture_from_nodepath(^"./country_budget/chart_2")
- _debt_chart = get_gfx_pie_chart_texture_from_nodepath(^"./country_budget/chart_debt")
+ _lower_class_chart = get_gui_pie_chart_from_nodepath(^"./country_budget/chart_0")
+ _middle_class_chart = get_gui_pie_chart_from_nodepath(^"./country_budget/chart_1")
+ _upper_class_chart = get_gui_pie_chart_from_nodepath(^"./country_budget/chart_2")
+ _debt_chart = get_gui_pie_chart_from_nodepath(^"./country_budget/chart_debt")
# TODO - generate strata pop type icons
diff --git a/game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd b/game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd
index fb11a31..0926fbb 100644
--- a/game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd
@@ -11,7 +11,7 @@ func _ready() -> void:
add_gui_element("country_diplomacy", "country_diplomacy")
- var close_button : Button = get_button_from_nodepath(^"./country_diplomacy/close_button")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_diplomacy/close_button")
if close_button:
close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
diff --git a/game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd b/game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd
index f3cc486..d57f0dd 100644
--- a/game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd
@@ -11,7 +11,7 @@ func _ready() -> void:
add_gui_element("country_military", "country_military")
- var close_button : Button = get_button_from_nodepath(^"./country_military/close_button")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_military/close_button")
if close_button:
close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
diff --git a/game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd b/game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd
index 7237bf5..b6b18a5 100644
--- a/game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd
@@ -11,7 +11,7 @@ func _ready() -> void:
add_gui_element("country_politics", "country_politics")
- var close_button : Button = get_button_from_nodepath(^"./country_politics/close_button")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_politics/close_button")
if close_button:
close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
diff --git a/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
index e078934..d8af97f 100644
--- a/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
@@ -13,20 +13,20 @@ var _province_list_scroll_index : int = 0
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_buttons : Array[GUIIconButton]
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]
-var _province_list_expand_icons : Array[GFXSpriteTexture]
+var _province_list_growth_icons : Array[GUIIcon]
+var _province_list_colony_buttons : Array[GUIIconButton]
+var _province_list_national_focus_buttons : Array[GUIIconButton]
+var _province_list_expand_buttons : Array[GUIIconButton]
-var _pop_filter_buttons : Array[Button]
+var _pop_filter_buttons : Array[GUIIconButton]
var _pop_filter_icons : Array[GFXSpriteTexture]
var _pop_filter_selected_icons : Array[GFXButtonStateTexture]
var _pop_filter_hover_icons : Array[GFXButtonStateTexture]
-var _distribution_charts : Array[GFXPieChartTexture]
+var _distribution_charts : Array[GUIPieChart]
var _distribution_lists : Array[GUIListBox]
var _pop_list_scrollbar : GUIScrollbar
@@ -34,30 +34,25 @@ var _pop_list_scroll_index : int = 0
var _pop_list_rows : Array[Panel]
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_type_buttons : Array[GUIIconButton]
+var _pop_list_producing_icons : Array[GUIIcon]
var _pop_list_culture_labels : Array[GUILabel]
-var _pop_list_religion_icons : Array[GFXSpriteTexture]
+var _pop_list_religion_icons : Array[GUIIcon]
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_ideology_charts : Array[GUIPieChart]
+var _pop_list_issues_charts : Array[GUIPieChart]
+var _pop_list_unemployment_progressbars : Array[GUIProgressBar]
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]
-var _pop_list_rebel_texture_rects : Array[TextureRect]
-var _pop_list_rebel_icons : Array[GFXSpriteTexture]
-var _pop_list_social_movement_texture_rects : Array[TextureRect]
-var _pop_list_social_movement_icons : Array[GFXSpriteTexture]
-var _pop_list_political_movement_texture_rects : Array[TextureRect]
-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_life_needs_progressbars : Array[GUIProgressBar]
+var _pop_list_everyday_needs_progressbars : Array[GUIProgressBar]
+var _pop_list_luxury_needs_progressbars : Array[GUIProgressBar]
+var _pop_list_rebel_icons : Array[GUIIcon]
+var _pop_list_social_movement_icons : Array[GUIIcon]
+var _pop_list_political_movement_icons : Array[GUIIcon]
+var _pop_list_national_movement_flags : Array[GUIMaskedFlag]
+var _pop_list_size_change_icons : Array[GUIIcon]
var _pop_list_literacy_labels : Array[GUILabel]
func _ready() -> void:
@@ -72,7 +67,7 @@ func _ready() -> void:
add_gui_element(_scene_name, "country_pop")
- var close_button : Button = get_button_from_nodepath(^"./country_pop/close_button")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_pop/close_button")
if close_button:
close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
@@ -91,13 +86,13 @@ func _generate_province_list_row(index : int, type : MenuSingleton.ProvinceListE
_province_list_types.push_back(MenuSingleton.LIST_ENTRY_NONE)
_province_list_indices.push_back(-1)
_province_list_panels.push_back(null)
- _province_list_button_icons.push_back(null)
+ _province_list_buttons.push_back(null)
_province_list_name_labels.push_back(null)
_province_list_size_labels.push_back(null)
_province_list_growth_icons.push_back(null)
_province_list_colony_buttons.push_back(null)
- _province_list_national_focus_icons.push_back(null)
- _province_list_expand_icons.push_back(null)
+ _province_list_national_focus_buttons.push_back(null)
+ _province_list_expand_buttons.push_back(null)
if _province_list_types[index] == type:
return OK
@@ -109,13 +104,13 @@ func _generate_province_list_row(index : int, type : MenuSingleton.ProvinceListE
_province_list_types[index] = MenuSingleton.LIST_ENTRY_NONE
_province_list_indices[index] = -1
_province_list_panels[index] = null
- _province_list_button_icons[index] = null
+ _province_list_buttons[index] = null
_province_list_name_labels[index] = null
_province_list_size_labels[index] = null
_province_list_growth_icons[index] = null
_province_list_colony_buttons[index] = null
- _province_list_national_focus_icons[index] = null
- _province_list_expand_icons[index] = null
+ _province_list_national_focus_buttons[index] = null
+ _province_list_expand_buttons[index] = null
if type == MenuSingleton.LIST_ENTRY_NONE:
return OK
@@ -135,33 +130,29 @@ func _generate_province_list_row(index : int, type : MenuSingleton.ProvinceListE
_province_list_panels[index] = entry_panel
- var base_button : Button = GUINode.get_button_from_node(entry_panel.get_node(^"./poplistbutton"))
- if base_button:
- base_button.pressed.connect(
+ _province_list_buttons[index] = GUINode.get_gui_icon_button_from_node(entry_panel.get_node(^"./poplistbutton"))
+ if _province_list_buttons[index]:
+ _province_list_buttons[index].pressed.connect(
func() -> void: MenuSingleton.population_menu_select_province_list_entry(_province_list_indices[index])
)
- _province_list_button_icons[index] = GUINode.get_gfx_sprite_texture_from_node(base_button)
_province_list_name_labels[index] = GUINode.get_gui_label_from_node(entry_panel.get_node(^"./poplist_name"))
_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"))
+ _province_list_growth_icons[index] = GUINode.get_gui_icon_from_node(entry_panel.get_node(^"./growth_indicator"))
if type == MenuSingleton.LIST_ENTRY_STATE:
- _province_list_colony_buttons[index] = GUINode.get_button_from_node(entry_panel.get_node(^"./colonial_state_icon"))
+ _province_list_colony_buttons[index] = GUINode.get_gui_icon_button_from_node(entry_panel.get_node(^"./colonial_state_icon"))
- var national_focus_button : Button = GUINode.get_button_from_node(entry_panel.get_node(^"./state_focus"))
- if national_focus_button:
- # TODO - connect national focus button to national focus selection submenu
- _province_list_national_focus_icons[index] = GUINode.get_gfx_sprite_texture_from_node(national_focus_button)
+ # TODO - connect national focus button to national focus selection submenu
+ _province_list_national_focus_buttons[index] = GUINode.get_gui_icon_button_from_node(entry_panel.get_node(^"./state_focus"))
- var expand_button : Button = GUINode.get_button_from_node(entry_panel.get_node(^"./expand"))
- if expand_button:
- expand_button.pressed.connect(
+ _province_list_expand_buttons[index] = GUINode.get_gui_icon_button_from_node(entry_panel.get_node(^"./expand"))
+ if _province_list_expand_buttons[index]:
+ _province_list_expand_buttons[index].pressed.connect(
func() -> void: MenuSingleton.population_menu_toggle_expanded(_province_list_indices[index])
)
- _province_list_expand_icons[index] = GUINode.get_gfx_sprite_texture_from_node(expand_button)
_province_listbox.add_child(entry_panel)
_province_listbox.move_child(entry_panel, index)
@@ -206,7 +197,7 @@ func _setup_sort_buttons() -> void:
]
for button_info : Array in sort_button_info:
- var sort_button : Button = get_button_from_nodepath(button_info[0])
+ var sort_button : GUIIconButton = get_gui_icon_button_from_nodepath(button_info[0])
if sort_button:
if button_info[1]:
sort_button.set_text("")
@@ -223,7 +214,7 @@ func _setup_pop_filter_buttons() -> void:
var pop_filter_step : Vector2 = GUINode.get_gui_position(_scene_name, "popfilter_offset")
for index : int in pop_filter_sprite_indices.size():
- var pop_filter_button : Button = GUINode.get_button_from_node(GUINode.generate_gui_element(_scene_name, "pop_filter_button"))
+ var pop_filter_button : GUIIconButton = GUINode.get_gui_icon_button_from_node(GUINode.generate_gui_element(_scene_name, "pop_filter_button"))
var pop_filter_icon : GFXSpriteTexture = null
var pop_filter_selected_icon : GFXButtonStateTexture = null
var pop_filter_hover_icon : GFXButtonStateTexture = null
@@ -232,7 +223,7 @@ func _setup_pop_filter_buttons() -> void:
_pop_screen_panel.add_child(pop_filter_button)
pop_filter_button.set_position(pop_filter_start + pop_filter_step * index)
pop_filter_button.pressed.connect(MenuSingleton.population_menu_toggle_pop_filter.bind(index))
- pop_filter_icon = GUINode.get_gfx_sprite_texture_from_node(pop_filter_button)
+ pop_filter_icon = pop_filter_button.get_gfx_sprite_texture()
if pop_filter_icon:
pop_filter_icon.set_icon_index(pop_filter_sprite_indices[index])
@@ -244,11 +235,11 @@ func _setup_pop_filter_buttons() -> void:
_pop_filter_selected_icons.push_back(pop_filter_selected_icon)
_pop_filter_hover_icons.push_back(pop_filter_hover_icon)
- var select_all_button : Button = get_button_from_nodepath(^"./country_pop/popfilter_ALL")
+ var select_all_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_pop/popfilter_ALL")
if select_all_button:
select_all_button.pressed.connect(MenuSingleton.population_menu_select_all_pop_filters)
- var deselect_all_button : Button = get_button_from_nodepath(^"./country_pop/popfilter_DESELECT_ALL")
+ var deselect_all_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_pop/popfilter_DESELECT_ALL")
if deselect_all_button:
deselect_all_button.pressed.connect(MenuSingleton.population_menu_deselect_all_pop_filters)
@@ -266,7 +257,7 @@ func _setup_distribution_windows() -> void:
for index : int in distribution_names.size():
var distribution_panel : Panel = GUINode.generate_gui_element(_scene_name, "distribution_window")
- var distribution_chart : GFXPieChartTexture = null
+ var distribution_chart : GUIPieChart = null
var distribution_list : GUIListBox = null
if distribution_panel:
@@ -277,7 +268,7 @@ func _setup_distribution_windows() -> void:
if name_label:
name_label.set_text(distribution_names[index])
- distribution_chart = GUINode.get_gfx_pie_chart_texture_from_node(distribution_panel.get_node(^"./chart"))
+ distribution_chart = GUINode.get_gui_pie_chart_from_node(distribution_panel.get_node(^"./chart"))
distribution_list = GUINode.get_gui_listbox_from_node(distribution_panel.get_node(^"./member_names"))
_distribution_charts.push_back(distribution_chart)
@@ -320,18 +311,16 @@ func _setup_pop_list() -> void:
_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"))
+ var pop_type_button : GUIIconButton = GUINode.get_gui_icon_button_from_node(pop_row_panel.get_node(^"./pop_type"))
# TODO - open pop details menu on pop type button press
_pop_list_type_buttons.push_back(pop_type_button)
- _pop_list_type_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_type_button))
-
- _pop_list_producing_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_row_panel.get_node(^"./pop_producing_icon")))
+ _pop_list_producing_icons.push_back(GUINode.get_gui_icon_from_node(pop_row_panel.get_node(^"./pop_producing_icon")))
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")))
+ _pop_list_religion_icons.push_back(GUINode.get_gui_icon_from_node(pop_row_panel.get_node(^"./pop_religion")))
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)
@@ -340,55 +329,35 @@ func _setup_pop_list() -> void:
_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")))
+ _pop_list_ideology_charts.push_back(GUINode.get_gui_pie_chart_from_node(pop_row_panel.get_node(^"./pop_ideology")))
- _pop_list_issues_charts.push_back(GUINode.get_gfx_pie_chart_texture_from_node(pop_row_panel.get_node(^"./pop_issues")))
+ _pop_list_issues_charts.push_back(GUINode.get_gui_pie_chart_from_node(pop_row_panel.get_node(^"./pop_issues")))
- _pop_list_unemployment_progressbars.push_back(GUINode.get_progress_bar_from_node(pop_row_panel.get_node(^"./pop_unemployment_bar")))
+ _pop_list_unemployment_progressbars.push_back(GUINode.get_gui_progress_bar_from_node(pop_row_panel.get_node(^"./pop_unemployment_bar")))
_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"))
+ var pop_list_life_needs_progressbar : GUIProgressBar = GUINode.get_gui_progress_bar_from_node(pop_row_panel.get_node(^"./lifeneed_progress"))
if pop_list_life_needs_progressbar:
pop_list_life_needs_progressbar.position += Vector2(1, 0)
_pop_list_life_needs_progressbars.push_back(pop_list_life_needs_progressbar)
- var pop_list_everyday_needs_progressbar : TextureProgressBar = GUINode.get_progress_bar_from_node(pop_row_panel.get_node(^"./eveneed_progress"))
+ var pop_list_everyday_needs_progressbar : GUIProgressBar = GUINode.get_gui_progress_bar_from_node(pop_row_panel.get_node(^"./eveneed_progress"))
if pop_list_everyday_needs_progressbar:
pop_list_everyday_needs_progressbar.position += Vector2(1, 0)
_pop_list_everyday_needs_progressbars.push_back(pop_list_everyday_needs_progressbar)
- _pop_list_luxury_needs_progressbars.push_back(GUINode.get_progress_bar_from_node(pop_row_panel.get_node(^"./luxneed_progress")))
+ _pop_list_luxury_needs_progressbars.push_back(GUINode.get_gui_progress_bar_from_node(pop_row_panel.get_node(^"./luxneed_progress")))
- var pop_list_rebel_texture_rect : TextureRect = GUINode.get_texture_rect_from_node(pop_row_panel.get_node(^"./pop_revolt"))
- _pop_list_rebel_texture_rects.push_back(pop_list_rebel_texture_rect)
- if pop_list_rebel_texture_rect:
- _pop_list_rebel_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_list_rebel_texture_rect))
- else:
- _pop_list_rebel_icons.push_back(null)
+ _pop_list_rebel_icons.push_back(GUINode.get_gui_icon_from_node(pop_row_panel.get_node(^"./pop_revolt")))
- var pop_list_social_movement_texture_rect : TextureRect = GUINode.get_texture_rect_from_node(pop_row_panel.get_node(^"./pop_movement_social"))
- _pop_list_social_movement_texture_rects.push_back(pop_list_social_movement_texture_rect)
- if pop_list_social_movement_texture_rect:
- _pop_list_social_movement_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_list_social_movement_texture_rect))
- else:
- _pop_list_social_movement_icons.push_back(null)
+ _pop_list_social_movement_icons.push_back(GUINode.get_gui_icon_from_node(pop_row_panel.get_node(^"./pop_movement_social")))
- var pop_list_political_movement_texture_rect : TextureRect = GUINode.get_texture_rect_from_node(pop_row_panel.get_node(^"./pop_movement_political"))
- _pop_list_political_movement_texture_rects.push_back(pop_list_political_movement_texture_rect)
- if pop_list_political_movement_texture_rect:
- _pop_list_political_movement_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_list_political_movement_texture_rect))
- else:
- _pop_list_political_movement_icons.push_back(null)
+ _pop_list_political_movement_icons.push_back(GUINode.get_gui_icon_from_node(pop_row_panel.get_node(^"./pop_movement_political")))
- var pop_list_national_movement_texture_rect : TextureRect = GUINode.get_texture_rect_from_node(pop_row_panel.get_node(^"./pop_movement_flag"))
- _pop_list_national_movement_texture_rects.push_back(pop_list_national_movement_texture_rect)
- if pop_list_national_movement_texture_rect:
- _pop_list_national_movement_flags.push_back(GUINode.get_gfx_masked_flag_texture_from_node(pop_list_national_movement_texture_rect))
- else:
- _pop_list_national_movement_flags.push_back(null)
+ _pop_list_national_movement_flags.push_back(GUINode.get_gui_masked_flag_from_node(pop_row_panel.get_node(^"./pop_movement_flag")))
- _pop_list_size_change_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_row_panel.get_node(^"./growth_indicator")))
+ _pop_list_size_change_icons.push_back(GUINode.get_gui_icon_from_node(pop_row_panel.get_node(^"./growth_indicator")))
_pop_list_literacy_labels.push_back(GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_literacy")))
@@ -450,8 +419,8 @@ func _update_province_list(scroll_index : int = -1) -> void:
_province_list_indices[index] = province_list_info[index_key]
- if _province_list_button_icons[index]:
- _province_list_button_icons[index].set_icon_index(1 + int(province_list_info[selected_key]))
+ if _province_list_buttons[index]:
+ _province_list_buttons[index].set_icon_index(1 + int(province_list_info[selected_key]))
if _province_list_name_labels[index]:
_province_list_name_labels[index].set_text(
@@ -469,10 +438,10 @@ func _update_province_list(scroll_index : int = -1) -> void:
if _province_list_colony_buttons[index]:
_province_list_colony_buttons[index].set_visible(province_list_info[colony_key])
- if _province_list_expand_icons[index]:
- _province_list_expand_icons[index].set_icon_index(1 + int(province_list_info[expanded_key]))
+ if _province_list_expand_buttons[index]:
+ _province_list_expand_buttons[index].set_icon_index(1 + int(province_list_info[expanded_key]))
- # TODO - set _province_list_national_focus_icons[index]
+ # TODO - set _province_list_national_focus_buttons[index]
# Clear any excess rows
for index : int in range(province_list_info_list.size(), _province_list_types.size()):
@@ -493,7 +462,7 @@ func _update_pop_filters() -> void:
var pop_filter_info : Dictionary = pop_filter_info_list[index]
- var pop_filter_button : Button = _pop_filter_buttons[index]
+ var pop_filter_button : GUIIconButton = _pop_filter_buttons[index]
if not pop_filter_button:
continue
pop_filter_button.disabled = pop_filter_info[pop_filter_count_key] <= 0
@@ -542,9 +511,9 @@ func _update_distributions():
var distribution_row : Dictionary = distribution_info[list_index]
- var colour_icon_rect : TextureRect = GUINode.get_texture_rect_from_node(child.get_node(^"./legend_color"))
- if colour_icon_rect:
- colour_icon_rect.set_modulate(distribution_row[slice_colour_key])
+ var colour_icon : GUIIcon = GUINode.get_gui_icon_from_node(child.get_node(^"./legend_color"))
+ if colour_icon:
+ colour_icon.set_modulate(distribution_row[slice_colour_key])
var identifier_label : GUILabel = GUINode.get_gui_label_from_node(child.get_node(^"./legend_title"))
if identifier_label:
@@ -592,8 +561,8 @@ func _update_pop_list() -> void:
if _pop_list_size_labels[index]:
_pop_list_size_labels[index].set_text(GUINode.int_to_string_suffixed(pop_row[pop_size_key]))
- if _pop_list_type_icons[index]:
- _pop_list_type_icons[index].set_icon_index(pop_row[pop_type_icon_key])
+ if _pop_list_type_buttons[index]:
+ _pop_list_type_buttons[index].set_icon_index(pop_row[pop_type_icon_key])
if _pop_list_culture_labels[index]:
_pop_list_culture_labels[index].set_text(pop_row[pop_culture_key])
if _pop_list_religion_icons[index]:
@@ -618,22 +587,21 @@ func _update_pop_list() -> void:
_pop_list_everyday_needs_progressbars[index].set_value_no_signal(pop_row[pop_everyday_needs_key])
if _pop_list_luxury_needs_progressbars[index]:
_pop_list_luxury_needs_progressbars[index].set_value_no_signal(pop_row[pop_luxury_needs_key])
- if _pop_list_rebel_texture_rects[index]:
+ if _pop_list_rebel_icons[index]:
var rebel_icon : int = pop_row.get(pop_rebel_icon_key, 0)
if rebel_icon > 0:
- if _pop_list_rebel_icons[index]:
- _pop_list_rebel_icons[index].set_icon_index(rebel_icon)
- _pop_list_rebel_texture_rects[index].show()
+ _pop_list_rebel_icons[index].set_icon_index(rebel_icon)
+ _pop_list_rebel_icons[index].show()
else:
- _pop_list_rebel_texture_rects[index].hide()
+ _pop_list_rebel_icons[index].hide()
# TODO - handle social/political reform and country rebels
- if _pop_list_social_movement_texture_rects[index]:
- _pop_list_social_movement_texture_rects[index].hide()
- if _pop_list_political_movement_texture_rects[index]:
- _pop_list_political_movement_texture_rects[index].hide()
- if _pop_list_national_movement_texture_rects[index]:
- _pop_list_national_movement_texture_rects[index].hide()
+ if _pop_list_social_movement_icons[index]:
+ _pop_list_social_movement_icons[index].hide()
+ if _pop_list_political_movement_icons[index]:
+ _pop_list_political_movement_icons[index].hide()
+ if _pop_list_national_movement_flags[index]:
+ _pop_list_national_movement_flags[index].hide()
if _pop_list_size_change_icons[index]:
_pop_list_size_change_icons[index].set_icon_index(get_growth_icon_index(pop_row[pop_size_change_key]))
diff --git a/game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd b/game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd
index 938f8e7..25a60df 100644
--- a/game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd
@@ -11,7 +11,7 @@ func _ready() -> void:
add_gui_element("country_production", "country_production")
- var close_button : Button = get_button_from_nodepath(^"./country_production/close_button")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_production/close_button")
if close_button:
close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
diff --git a/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd b/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd
index a80ed1e..97c3390 100644
--- a/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd
@@ -11,7 +11,7 @@ func _ready() -> void:
add_gui_element("country_technology", "country_technology")
- var close_button : Button = get_button_from_nodepath(^"./country_technology/close_button")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_technology/close_button")
if close_button:
close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
diff --git a/game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd b/game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd
index 775f31a..2454b96 100644
--- a/game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd
@@ -11,7 +11,7 @@ func _ready() -> void:
add_gui_element("country_trade", "country_trade")
- var close_button : Button = get_button_from_nodepath(^"./country_trade/close_button")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./country_trade/close_button")
if close_button:
close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel.gd b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
index f2669c0..66fd463 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel.gd
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
@@ -3,32 +3,31 @@ extends GUINode
# Header
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 _slave_status_icon : GUIIcon
+var _colony_status_button : GUIIconButton
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
-var _controller_flag_texture : GFXMaskedFlagTexture
+var _terrain_type_icon : GUIIcon
+var _life_rating_bar : GUIProgressBar
+var _controller_flag : GUIMaskedFlag
# Statistics
-var _rgo_icon_texture : GFXSpriteTexture
+var _rgo_icon : GUIIcon
var _rgo_produced_label : GUILabel
var _rgo_income_label : GUILabel
-var _rgo_employment_percentage_texture : GFXSpriteTexture
+var _rgo_employment_percentage_icon : GUIIcon
var _rgo_employment_population_label : GUILabel
var _rgo_employment_percentage_label : GUILabel
var _crime_name_label : GUILabel
-var _crime_icon_texture : GFXSpriteTexture
+var _crime_icon : GUIIcon
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 _pop_types_piechart : GUIPieChart
+var _pop_ideologies_piechart : GUIPieChart
+var _pop_cultures_piechart : GUIPieChart
var _supply_limit_label : GUILabel
var _cores_overlapping_elements_box : GUIOverlappingElementsBox
@@ -44,10 +43,10 @@ class BuildingSlot:
var _slot_index : int
var _slot_node : Control
- var _building_icon : GFXSpriteTexture
- var _expand_button : Button
- var _expanding_icon : TextureRect
- var _expanding_progress_bar : TextureProgressBar
+ var _building_icon : GUIIcon
+ var _expand_button : GUIIconButton
+ var _expanding_icon : GUIIcon
+ var _expanding_progress_bar : GUIProgressBar
var _expanding_label : GUILabel
func _init(new_slot_index : int, new_slot_node : Control) -> void:
@@ -64,18 +63,18 @@ class BuildingSlot:
var icon := _slot_node.get_node("build_icon%d" % icon_index)
if icon:
if icon_index == _slot_index:
- _building_icon = GUINode.get_gfx_sprite_texture_from_node(icon)
+ _building_icon = GUINode.get_gui_icon_from_node(icon)
else:
icon.hide()
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"))
+ _expand_button = GUINode.get_gui_icon_button_from_node(_slot_node.get_node(^"./expand"))
if _expand_button:
_expand_button.pressed.connect(func() -> void: MenuSingleton.expand_selected_province_building(_slot_index))
- _expanding_icon = GUINode.get_texture_rect_from_node(_slot_node.get_node(^"./underconstruction_icon"))
- _expanding_progress_bar = GUINode.get_progress_bar_from_node(_slot_node.get_node(^"./building_progress"))
+ _expanding_icon = GUINode.get_gui_icon_from_node(_slot_node.get_node(^"./underconstruction_icon"))
+ _expanding_progress_bar = GUINode.get_gui_progress_bar_from_node(_slot_node.get_node(^"./building_progress"))
if _expanding_progress_bar:
_expanding_progress_bar.max_value = 1.0
_expanding_progress_bar.step = _expanding_progress_bar.max_value / 100
@@ -131,7 +130,7 @@ func _ready() -> void:
prov_view.mouse_filter = Control.MOUSE_FILTER_IGNORE
set_click_mask_from_nodepaths([^"./province_view/background"])
- var close_button : Button = get_button_from_nodepath(^"./province_view/close_button")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./province_view/close_button")
if close_button:
close_button.pressed.connect(_on_close_button_pressed)
@@ -141,41 +140,39 @@ func _ready() -> void:
if _state_name_label:
# State names are already translated in the MenuSingleton
_state_name_label.auto_translate = false
- _slave_status_icon = get_texture_rect_from_nodepath(^"./province_view/province_view_header/slave_state_icon")
- var slave_status_icon_texture : GFXSpriteTexture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_view_header/slave_state_icon")
- if slave_status_icon_texture:
- slave_status_icon_texture.set_icon_index(MenuSingleton.get_slave_pop_icon_index())
- _colony_status_button = get_button_from_nodepath(^"./province_view/province_view_header/colony_button")
- _colony_status_button_texture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_view_header/colony_button")
- 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())
+ _slave_status_icon = get_gui_icon_from_nodepath(^"./province_view/province_view_header/slave_state_icon")
+ if _slave_status_icon:
+ _slave_status_icon.set_icon_index(MenuSingleton.get_slave_pop_icon_index())
+ _colony_status_button = get_gui_icon_button_from_nodepath(^"./province_view/province_view_header/colony_button")
+ var admin_icon : GUIIcon = get_gui_icon_from_nodepath(^"./province_view/province_view_header/admin_icon")
+ if admin_icon:
+ admin_icon.set_icon_index(MenuSingleton.get_administrative_pop_icon_index())
_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
- _terrain_type_texture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_view_header/prov_terrain")
- _life_rating_bar = get_progress_bar_from_nodepath(^"./province_view/province_view_header/liferating")
- _controller_flag_texture = get_gfx_masked_flag_texture_from_nodepath(^"./province_view/province_view_header/controller_flag")
+ _terrain_type_icon = get_gui_icon_from_nodepath(^"./province_view/province_view_header/prov_terrain")
+ _life_rating_bar = get_gui_progress_bar_from_nodepath(^"./province_view/province_view_header/liferating")
+ _controller_flag = get_gui_masked_flag_from_nodepath(^"./province_view/province_view_header/controller_flag")
# Statistics
- _rgo_icon_texture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_statistics/goods_type")
+ _rgo_icon = get_gui_icon_from_nodepath(^"./province_view/province_statistics/goods_type")
_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_percentage_icon = get_gui_icon_from_nodepath(^"./province_view/province_statistics/employment_ratio")
_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_icon = get_gui_icon_from_nodepath(^"./province_view/province_statistics/crime_icon")
_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")
- var population_menu_button : Button = get_button_from_nodepath(^"./province_view/province_statistics/open_popscreen")
+ _pop_types_piechart = get_gui_pie_chart_from_nodepath(^"./province_view/province_statistics/workforce_chart")
+ _pop_ideologies_piechart = get_gui_pie_chart_from_nodepath(^"./province_view/province_statistics/ideology_chart")
+ _pop_cultures_piechart = get_gui_pie_chart_from_nodepath(^"./province_view/province_statistics/culture_chart")
+ var population_menu_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./province_view/province_statistics/open_popscreen")
if population_menu_button:
population_menu_button.pressed.connect(
func() -> void:
@@ -227,11 +224,11 @@ enum ColonyStatus { STATE, PROTECTORATE, COLONY }
# This assumes _cores_overlapping_elements_box is non-null
func _set_core_flag(core_index : int, country : String) -> void:
- var core_flag_texture : GFXMaskedFlagTexture = GUINode.get_gfx_masked_flag_texture_from_node(
+ var core_flag_button : GUIMaskedFlagButton = GUINode.get_gui_masked_flag_button_from_node(
_cores_overlapping_elements_box.get_child(core_index).get_node(^"./country_flag")
)
- if core_flag_texture:
- core_flag_texture.set_flag_country_name(country)
+ if core_flag_button:
+ core_flag_button.set_flag_country_name(country)
func _update_info() -> void:
const _province_info_province_key : StringName = &"province"
@@ -271,8 +268,7 @@ func _update_info() -> void:
if colony_status == ColonyStatus.STATE:
_colony_status_button.hide()
else:
- if _colony_status_button_texture:
- _colony_status_button_texture.set_icon_index(colony_status)
+ _colony_status_button.set_icon_index(colony_status)
_colony_status_button.show()
if _administrative_percentage_label:
@@ -285,28 +281,28 @@ func _update_info() -> void:
# TODO - replace example icons with those from the province's list of modifier instances
_province_modifiers_overlapping_elements_box.set_child_count(8)
for i : int in _province_modifiers_overlapping_elements_box.get_child_count():
- var icon : GFXSpriteTexture = GUINode.get_gfx_sprite_texture_from_node(
+ var button : GUIIconButton = GUINode.get_gui_icon_button_from_node(
_province_modifiers_overlapping_elements_box.get_child(i).get_node(^"./modifier")
)
- if icon:
- icon.set_icon_index(2 * i + (i & 1) + 1)
+ if button:
+ button.set_icon_index(2 * i + (i & 1) + 1)
- if _terrain_type_texture:
+ if _terrain_type_icon:
var terrain_type : String = _province_info.get(_province_info_terrain_type_key, "")
if terrain_type:
const _terrain_type_prefix : String = "GFX_terrainimg_"
- if _terrain_type_texture.set_gfx_texture_sprite_name(_terrain_type_prefix + terrain_type) != OK:
+ if _terrain_type_icon.set_gfx_texture_sprite_name(_terrain_type_prefix + terrain_type) != OK:
push_error("Failed to set terrain type texture: ", terrain_type)
if _life_rating_bar:
_life_rating_bar.value = _province_info.get(_province_info_life_rating_key, 0) / 100.0
- if _controller_flag_texture:
- _controller_flag_texture.set_flag_country_name(_province_info.get(_province_info_controller_key, ""))
+ if _controller_flag:
+ _controller_flag.set_flag_country_name(_province_info.get(_province_info_controller_key, ""))
# Statistics
- if _rgo_icon_texture:
- _rgo_icon_texture.set_icon_index(_province_info.get(_province_info_rgo_icon_key, -1) + 2)
+ if _rgo_icon:
+ _rgo_icon.set_icon_index(_province_info.get(_province_info_rgo_icon_key, -1) + 2)
if _rgo_produced_label:
# TODO - replace name with amount produced
@@ -316,7 +312,7 @@ func _update_info() -> void:
# TODO - add £ sign and replace placeholder with actual value
_rgo_income_label.text = "%s¤" % GUINode.float_to_string_dp(12.34567, 3)
- if _rgo_employment_percentage_texture:
+ if _rgo_employment_percentage_icon:
pass
if _rgo_employment_population_label:
@@ -329,8 +325,8 @@ func _update_info() -> void:
if _crime_name_label:
_crime_name_label.text = _province_info.get(_province_info_crime_name_key, "")
- if _crime_icon_texture:
- _crime_icon_texture.set_icon_index(_province_info.get(_province_info_crime_icon_key, 0) + 1)
+ if _crime_icon:
+ _crime_icon.set_icon_index(_province_info.get(_province_info_crime_icon_key, 0) + 1)
if _crime_fighting_label:
pass
diff --git a/game/src/Game/GameSession/SearchPanel.gd b/game/src/Game/GameSession/SearchPanel.gd
index c41660f..d13c11f 100644
--- a/game/src/Game/GameSession/SearchPanel.gd
+++ b/game/src/Game/GameSession/SearchPanel.gd
@@ -5,7 +5,7 @@ extends GUINode
var _search_panel : Panel
var _search_line_edit : LineEdit
var _results_list_box : GUIListBox
-var _result_buttons : Array[Button]
+var _result_buttons : Array[GUIIconButton]
var _drag_active : bool = false
var _drag_anchor : Vector2
@@ -19,11 +19,11 @@ func _ready() -> void:
_search_panel = get_panel_from_nodepath(^"./goto_box")
- var close_button : Button = get_button_from_nodepath(^"./goto_box/cancel")
+ var close_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./goto_box/cancel")
if close_button:
close_button.pressed.connect(hide)
- var panel_button : Button = get_button_from_nodepath(^"./goto_box/goto_box")
+ var panel_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./goto_box/goto_box")
if panel_button:
panel_button.button_down.connect(_start_drag)
panel_button.button_up.connect(_end_drag)
@@ -97,7 +97,7 @@ func _add_result_button() -> bool:
if not child:
return false
- var button : Button = GUINode.get_button_from_node(child.get_node(^"./game"))
+ var button : GUIIconButton = GUINode.get_gui_icon_button_from_node(child.get_node(^"./game"))
if not button:
child.queue_free()
return false
diff --git a/game/src/Game/GameSession/Topbar.gd b/game/src/Game/GameSession/Topbar.gd
index d6cc358..62fa322 100644
--- a/game/src/Game/GameSession/Topbar.gd
+++ b/game/src/Game/GameSession/Topbar.gd
@@ -1,8 +1,8 @@
extends GUINode
# Country info
-var _country_flag_texture : GFXMaskedFlagTexture
-var _country_flag_overlay_texture : GFXSpriteTexture
+var _country_flag_button : GUIMaskedFlagButton
+var _country_flag_overlay_icon : GUIIcon
var _country_name_label : GUILabel
var _country_rank_label : GUILabel
var _country_prestige_label : GUILabel
@@ -14,41 +14,39 @@ 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 _speed_up_button : GUIIconButton
+var _speed_down_button : GUIIconButton
+var _speed_indicator_button : GUIIconButton
var _date_label : GUILabel
-# NationManagement.Screen-Button
+# NationManagement.Screen-GUIIconButton
var _nation_management_buttons : Dictionary
-# NationManagement.Screen-GFXSpriteTexture
-var _nation_management_button_textures : Dictionary
# Production
-var _production_top_goods_textures : Array[GFXSpriteTexture]
-var _production_alert_building_texture : GFXSpriteTexture
-var _production_alert_closed_texture : GFXSpriteTexture
-var _production_alert_unemployment_texture : GFXSpriteTexture
+var _production_top_goods_icons : Array[GUIIcon]
+var _production_alert_building_icon : GUIIcon
+var _production_alert_closed_icon : GUIIcon
+var _production_alert_unemployment_icon : GUIIcon
# Budget
# TODO - line chart
var _budget_funds_label : GUILabel
# Technology
-var _technology_progress_bar : TextureProgressBar
+var _technology_progress_bar : GUIProgressBar
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_icon : GUIIcon
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
+var _politics_reforms_button : GUIButton
+var _politics_decisions_button : GUIIconButton
+var _politics_election_icon : GUIIcon
+var _politics_rebels_button : GUIIconButton
# Population
var _population_total_size_label : GUILabel
@@ -57,17 +55,17 @@ var _population_militancy_label : GUILabel
var _population_consciousness_label : GUILabel
# Trade
-var _trade_imported_textures : Array[GFXSpriteTexture]
-var _trade_exported_textures : Array[GFXSpriteTexture]
+var _trade_imported_icons : Array[GUIIcon]
+var _trade_exported_icons : Array[GUIIcon]
# Diplomacy
var _diplomacy_peace_label : GUILabel
var _diplomacy_war_enemies_overlapping_elements_box : GUIOverlappingElementsBox
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
+var _diplomacy_alert_colony_button : GUIIconButton
+var _diplomacy_alert_crisis_icon : GUIIcon
+var _diplomacy_alert_sphere_icon : GUIIcon
+var _diplomacy_alert_great_power_icon : GUIIcon
# Military
var _military_army_size_label : GUILabel
@@ -87,21 +85,20 @@ func _ready() -> void:
])
# Disables all consuming invisible panel
- var topbar := get_panel_from_nodepath(^"./topbar")
+ var topbar : Panel = get_panel_from_nodepath(^"./topbar")
if topbar:
topbar.mouse_filter = Control.MOUSE_FILTER_IGNORE
set_click_mask_from_nodepaths([^"./topbar/topbar_bg", ^"./topbar/topbar_paper"])
# Country info
- var country_flag_button = get_button_from_nodepath(^"./topbar/player_flag")
- if country_flag_button:
- country_flag_button.pressed.connect(
+ _country_flag_button = get_gui_masked_flag_button_from_nodepath(^"./topbar/player_flag")
+ if _country_flag_button:
+ _country_flag_button.pressed.connect(
func() -> void:
# TODO - open the diplomacy menu on the Wars tab
Events.NationManagementScreens.open_nation_management_screen(NationManagement.Screen.DIPLOMACY)
)
- _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_flag_overlay_icon = get_gui_icon_from_nodepath(^"./topbar/topbar_flag_overlay")
_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")
@@ -113,19 +110,18 @@ func _ready() -> void:
_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")
+ _speed_up_button = get_gui_icon_button_from_nodepath(^"./topbar/button_speedup")
if _speed_up_button:
_speed_up_button.pressed.connect(_on_increase_speed_button_pressed)
- _speed_down_button = get_button_from_nodepath(^"./topbar/button_speeddown")
+ _speed_down_button = get_gui_icon_button_from_nodepath(^"./topbar/button_speeddown")
if _speed_down_button:
_speed_down_button.pressed.connect(_on_decrease_speed_button_pressed)
- var pause_bg_button : Button = get_button_from_nodepath(^"./topbar/pause_bg")
+ var pause_bg_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./topbar/pause_bg")
if pause_bg_button:
pause_bg_button.pressed.connect(_on_play_pause_button_pressed)
- var speed_indicator_button = get_button_from_nodepath(^"./topbar/speed_indicator")
- 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)
+ _speed_indicator_button = get_gui_icon_button_from_nodepath(^"./topbar/speed_indicator")
+ if _speed_indicator_button:
+ _speed_indicator_button.pressed.connect(_on_play_pause_button_pressed)
_date_label = get_gui_label_from_nodepath(^"./topbar/DateText")
# Nation management screens
@@ -140,40 +136,37 @@ func _ready() -> void:
NationManagement.Screen.MILITARY : ^"./topbar/topbarbutton_military"
}
for screen : NationManagement.Screen in screen_nodepaths:
- var button : Button = get_button_from_nodepath(screen_nodepaths[screen])
+ var button : GUIIconButton = get_gui_icon_button_from_nodepath(screen_nodepaths[screen])
if button:
button.pressed.connect(
Events.NationManagementScreens.toggle_nation_management_screen.bind(screen)
)
- var icon : GFXSpriteTexture = GUINode.get_gfx_sprite_texture_from_node(button)
- if icon:
- _nation_management_buttons[screen] = button
- _nation_management_button_textures[screen] = icon
+ _nation_management_buttons[screen] = button
Events.NationManagementScreens.update_active_nation_management_screen.connect(
_on_update_active_nation_management_screen
)
# Production
const PRODUCED_GOOD_COUNT : int = 5
- for idx in PRODUCED_GOOD_COUNT:
- _production_top_goods_textures.push_back(get_gfx_sprite_texture_from_nodepath("./topbar/topbar_produced%d" % idx))
- _production_alert_building_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/alert_building_factories")
- _production_alert_closed_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/alert_closed_factories")
- _production_alert_unemployment_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/alert_unemployed_workers")
+ for idx : int in PRODUCED_GOOD_COUNT:
+ _production_top_goods_icons.push_back(get_gui_icon_from_nodepath("./topbar/topbar_produced%d" % idx))
+ _production_alert_building_icon = get_gui_icon_from_nodepath(^"./topbar/alert_building_factories")
+ _production_alert_closed_icon = get_gui_icon_from_nodepath(^"./topbar/alert_closed_factories")
+ _production_alert_unemployment_icon = get_gui_icon_from_nodepath(^"./topbar/alert_unemployed_workers")
# Budget
_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_progress_bar = get_gui_progress_bar_from_nodepath(^"./topbar/topbar_tech_progress")
_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_icon = get_gui_icon_from_nodepath(^"./topbar/politics_party_icon")
_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")
+ var politics_suppression_button : GUIIconButton = get_gui_icon_button_from_nodepath(^"./topbar/topbar_supression_icon")
if politics_suppression_button:
politics_suppression_button.pressed.connect(
func() -> void:
@@ -182,31 +175,28 @@ func _ready() -> void:
)
_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(
+ _politics_reforms_button = get_gui_icon_button_from_nodepath(^"./topbar/alert_can_do_reforms")
+ if _politics_reforms_button:
+ _politics_reforms_button.pressed.connect(
func() -> void:
# TODO - open the politics menu on the Reforms tab
Events.NationManagementScreens.toggle_nation_management_screen(NationManagement.Screen.POLITICS)
)
- _politics_reforms_texture = GUINode.get_gfx_sprite_texture_from_node(politics_reforms_button)
- var politics_decisions_button : Button = get_button_from_nodepath(^"./topbar/alert_can_do_decisions")
- if politics_decisions_button:
- politics_decisions_button.pressed.connect(
+ _politics_decisions_button = get_gui_icon_button_from_nodepath(^"./topbar/alert_can_do_decisions")
+ if _politics_decisions_button:
+ _politics_decisions_button.pressed.connect(
func() -> void:
# TODO - open the politics menu on the Decisions tab
Events.NationManagementScreens.toggle_nation_management_screen(NationManagement.Screen.POLITICS)
)
- _politics_decisions_texture = GUINode.get_gfx_sprite_texture_from_node(politics_decisions_button)
- _politics_election_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/alert_is_in_election")
- var politics_rebels_button : Button = get_button_from_nodepath(^"./topbar/alert_have_rebels")
- if politics_rebels_button:
- politics_rebels_button.pressed.connect(
+ _politics_election_icon = get_gui_icon_from_nodepath(^"./topbar/alert_is_in_election")
+ _politics_rebels_button = get_gui_icon_button_from_nodepath(^"./topbar/alert_have_rebels")
+ if _politics_rebels_button:
+ _politics_rebels_button.pressed.connect(
func() -> void:
# TODO - open the politics menu on the Movements tab
Events.NationManagementScreens.toggle_nation_management_screen(NationManagement.Screen.POLITICS)
)
- _politics_rebels_texture = GUINode.get_gfx_sprite_texture_from_node(politics_rebels_button)
# Population
_population_total_size_label = get_gui_label_from_nodepath(^"./topbar/population_total_value")
@@ -217,24 +207,23 @@ func _ready() -> void:
# Trade
const TRADE_GOOD_COUNT : int = 3
for idx in TRADE_GOOD_COUNT:
- _trade_imported_textures.push_back(get_gfx_sprite_texture_from_nodepath("./topbar/topbar_import%d" % idx))
- _trade_exported_textures.push_back(get_gfx_sprite_texture_from_nodepath("./topbar/topbar_export%d" % idx))
+ _trade_imported_icons.push_back(get_gui_icon_from_nodepath("./topbar/topbar_import%d" % idx))
+ _trade_exported_icons.push_back(get_gui_icon_from_nodepath("./topbar/topbar_export%d" % idx))
# Diplomacy
_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_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(
+ _diplomacy_alert_colony_button = get_gui_icon_button_from_nodepath(^"./topbar/alert_colony")
+ if _diplomacy_alert_colony_button:
+ _diplomacy_alert_colony_button.pressed.connect(
func() -> void:
# TODO - move to and select province in upgradable colony if any exist
Events.NationManagementScreens.open_nation_management_screen(NationManagement.Screen.DIPLOMACY)
)
- _diplomacy_alert_colony_texture = GUINode.get_gfx_sprite_texture_from_node(diplomacy_alert_colony_button)
- _diplomacy_alert_crisis_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/alert_crisis")
- _diplomacy_alert_sphere_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/alert_can_increase_opinion")
- _diplomacy_alert_great_power_texture = get_gfx_sprite_texture_from_nodepath(^"./topbar/alert_loosing_gp")
+ _diplomacy_alert_crisis_icon = get_gui_icon_from_nodepath(^"./topbar/alert_crisis")
+ _diplomacy_alert_sphere_icon = get_gui_icon_from_nodepath(^"./topbar/alert_can_increase_opinion")
+ _diplomacy_alert_great_power_icon = get_gui_icon_from_nodepath(^"./topbar/alert_loosing_gp")
# Military
_military_army_size_label = get_gui_label_from_nodepath(^"./topbar/military_army_value")
@@ -255,15 +244,15 @@ func _update_info() -> void:
const player_country : String = "ENG"
## Country info
- if _country_flag_texture:
- _country_flag_texture.set_flag_country_name(player_country)
+ if _country_flag_button:
+ _country_flag_button.set_flag_country_name(player_country)
- if _country_flag_overlay_texture:
+ if _country_flag_overlay_icon:
# 1 - Great Power
# 2 - Secondary Power
# 3 - Civilised
# 4 - Uncivilised
- _country_flag_overlay_texture.set_icon_index(1)
+ _country_flag_overlay_icon.set_icon_index(1)
if _country_name_label:
_country_name_label.set_text(player_country)
@@ -301,18 +290,18 @@ func _update_info() -> void:
_date_label.text = MenuSingleton.get_longform_date()
## Production
- for idx : int in _production_top_goods_textures.size():
- if _production_top_goods_textures[idx]:
- _production_top_goods_textures[idx].set_icon_index(idx + 2)
+ for idx : int in _production_top_goods_icons.size():
+ if _production_top_goods_icons[idx]:
+ _production_top_goods_icons[idx].set_icon_index(idx + 2)
- if _production_alert_building_texture:
- _production_alert_building_texture.set_icon_index(2)
+ if _production_alert_building_icon:
+ _production_alert_building_icon.set_icon_index(2)
- if _production_alert_closed_texture:
- _production_alert_closed_texture.set_icon_index(2)
+ if _production_alert_closed_icon:
+ _production_alert_closed_icon.set_icon_index(2)
- if _production_alert_unemployment_texture:
- _production_alert_unemployment_texture.set_icon_index(2)
+ if _production_alert_unemployment_icon:
+ _production_alert_unemployment_icon.set_icon_index(2)
## Budget
if _budget_funds_label:
@@ -351,17 +340,17 @@ func _update_info() -> void:
if _politics_infamy_label:
_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)
+ if _politics_reforms_button:
+ _politics_reforms_button.set_icon_index(2)
- if _politics_decisions_texture:
- _politics_decisions_texture.set_icon_index(2)
+ if _politics_decisions_button:
+ _politics_decisions_button.set_icon_index(2)
- if _politics_election_texture:
- _politics_election_texture.set_icon_index(2)
+ if _politics_election_icon:
+ _politics_election_icon.set_icon_index(2)
- if _politics_rebels_texture:
- _politics_rebels_texture.set_icon_index(2)
+ if _politics_rebels_button:
+ _politics_rebels_button.set_icon_index(2)
## Population
if _population_total_size_label:
@@ -386,13 +375,13 @@ func _update_info() -> void:
_population_consciousness_label.set_text("§Y%s" % GUINode.float_to_string_dp(0.05, 2))
## Trade
- for idx : int in _trade_imported_textures.size():
- if _trade_imported_textures[idx]:
- _trade_imported_textures[idx].set_icon_index(idx + 2 + _production_top_goods_textures.size())
+ for idx : int in _trade_imported_icons.size():
+ if _trade_imported_icons[idx]:
+ _trade_imported_icons[idx].set_icon_index(idx + 2 + _production_top_goods_icons.size())
- for idx : int in _trade_exported_textures.size():
- if _trade_exported_textures[idx]:
- _trade_exported_textures[idx].set_icon_index(idx + 2 + _production_top_goods_textures.size() + _trade_imported_textures.size())
+ for idx : int in _trade_exported_icons.size():
+ if _trade_exported_icons[idx]:
+ _trade_exported_icons[idx].set_icon_index(idx + 2 + _production_top_goods_icons.size() + _trade_imported_icons.size())
## Diplomacy
if _diplomacy_peace_label:
@@ -403,17 +392,17 @@ func _update_info() -> void:
if _diplomacy_diplomatic_points_label:
_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)
+ if _diplomacy_alert_colony_button:
+ _diplomacy_alert_colony_button.set_icon_index(3)
- if _diplomacy_alert_crisis_texture:
- _diplomacy_alert_crisis_texture.set_icon_index(3)
+ if _diplomacy_alert_crisis_icon:
+ _diplomacy_alert_crisis_icon.set_icon_index(3)
- if _diplomacy_alert_sphere_texture:
- _diplomacy_alert_sphere_texture.set_icon_index(2)
+ if _diplomacy_alert_sphere_icon:
+ _diplomacy_alert_sphere_icon.set_icon_index(2)
- if _diplomacy_alert_great_power_texture:
- _diplomacy_alert_great_power_texture.set_icon_index(2)
+ if _diplomacy_alert_great_power_icon:
+ _diplomacy_alert_great_power_icon.set_icon_index(2)
## Military
if _military_army_size_label:
@@ -437,11 +426,11 @@ func _update_speed_controls() -> void:
#if _speed_down_button:
# _speed_down_button.disabled = not MenuSingleton.can_decrease_speed()
- if _speed_indicator_texture:
+ if _speed_indicator_button:
var index : int = 1
if not MenuSingleton.is_paused():
index += MenuSingleton.get_speed() + 1
- _speed_indicator_texture.set_icon_index(index)
+ _speed_indicator_button.set_icon_index(index)
# REQUIREMENTS:
# * UIFUN-71
@@ -463,4 +452,4 @@ func _on_decrease_speed_button_pressed() -> void:
func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
for screen : NationManagement.Screen in _nation_management_buttons:
- _nation_management_button_textures[screen].set_icon_index(1 + int(screen == active_screen))
+ _nation_management_buttons[screen].set_icon_index(1 + int(screen == active_screen))