diff options
Diffstat (limited to 'game/src/Game/GameSession/NationManagementScreen')
8 files changed, 195 insertions, 149 deletions
diff --git a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd index 20eb198..021c9f2 100644 --- a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd +++ b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd @@ -35,13 +35,19 @@ 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 +# TODO - testing function, should be replaced with calls to SIM which trigger UI updates through gamestate_updated +func _on_tax_slider_changed(slider : GUIScrollbar, label : GUILabel, tooltip : String, value : int) -> void: + label.text = "%s¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1) + slider.set_tooltip_string("%s: §Y%s%%" % [tr(tooltip), GUINode.float_to_string_dp(value, 1)]) + + func _ready() -> void: GameSingleton.gamestate_updated.connect(_update_info) @@ -49,7 +55,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)) @@ -87,15 +93,24 @@ func _ready() -> void: # 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¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1)) + _lower_class_slider.value_changed.connect( + func (value : int) -> void: + _on_tax_slider_changed(_lower_class_slider, _lower_class_label, "BUDGET_TAX_POOR", value) + ) _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¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1)) + _middle_class_slider.value_changed.connect( + func (value : int) -> void: + _on_tax_slider_changed(_middle_class_slider, _middle_class_label, "BUDGET_TAX_MIDDLE", value) + ) _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¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1)) + _upper_class_slider.value_changed.connect( + func (value : int) -> void: + _on_tax_slider_changed(_upper_class_slider, _upper_class_label, "BUDGET_TAX_RICH", value) + ) _upper_class_slider.emit_value_changed() # costs @@ -144,30 +159,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..eb57387 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,77 +311,77 @@ 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) + if culture_label: + culture_label.set_mouse_filter(MOUSE_FILTER_PASS) - _pop_list_religion_icons.push_back(GUINode.get_gfx_sprite_texture_from_node(pop_row_panel.get_node(^"./pop_religion"))) + var religion_icon : GUIIcon = GUINode.get_gui_icon_from_node(pop_row_panel.get_node(^"./pop_religion")) + _pop_list_religion_icons.push_back(religion_icon) + if religion_icon: + religion_icon.set_mouse_filter(MOUSE_FILTER_PASS) 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) + if location_label: + location_label.set_mouse_filter(MOUSE_FILTER_PASS) - _pop_list_militancy_labels.push_back(GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_mil"))) + var militancy_label : GUILabel = GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_mil")) + _pop_list_militancy_labels.push_back(militancy_label) + if militancy_label: + militancy_label.set_mouse_filter(MOUSE_FILTER_PASS) - _pop_list_consciousness_labels.push_back(GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_con"))) + var consciousness_label : GUILabel = GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_con")) + _pop_list_consciousness_labels.push_back(consciousness_label) + if consciousness_label: + consciousness_label.set_mouse_filter(MOUSE_FILTER_PASS) - _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 cash_label : GUILabel = GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_cash")) + _pop_list_cash_labels.push_back(cash_label) + if cash_label: + cash_label.set_mouse_filter(MOUSE_FILTER_PASS) - 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")) + _pop_list_life_needs_progressbars.push_back(pop_list_life_needs_progressbar) 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")) + _pop_list_everyday_needs_progressbars.push_back(pop_list_everyday_needs_progressbar) 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"))) + var size_change_icon : GUIIcon = GUINode.get_gui_icon_from_node(pop_row_panel.get_node(^"./growth_indicator")) + _pop_list_size_change_icons.push_back(size_change_icon) + if size_change_icon: + size_change_icon.set_mouse_filter(MOUSE_FILTER_PASS) - _pop_list_literacy_labels.push_back(GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_literacy"))) + var literacy_label : GUILabel = GUINode.get_gui_label_from_node(pop_row_panel.get_node(^"./pop_literacy")) + _pop_list_literacy_labels.push_back(literacy_label) + if literacy_label: + literacy_label.set_mouse_filter(MOUSE_FILTER_PASS) func _notification(what : int) -> void: match what: @@ -450,8 +441,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 +460,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 +484,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 +533,13 @@ 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]) + colour_icon.set_mouse_filter(MOUSE_FILTER_PASS) + colour_icon.set_tooltip_string_and_substitution_dict("§Y$ID$§!: $PC$%", { + "ID": distribution_row[slice_identifier_key], "PC": GUINode.float_to_string_dp(distribution_row[slice_weight_key] * 100.0, 2) + }) var identifier_label : GUILabel = GUINode.get_gui_label_from_node(child.get_node(^"./legend_title")) if identifier_label: @@ -592,53 +587,89 @@ 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]) + # TODO - replace with actual poptype + _pop_list_type_buttons[index].set_tooltip_string("Pop Type #%d" % pop_row[pop_type_icon_key]) if _pop_list_culture_labels[index]: _pop_list_culture_labels[index].set_text(pop_row[pop_culture_key]) + _pop_list_culture_labels[index].set_tooltip_string("NO_ASSIM_NOW") if _pop_list_religion_icons[index]: _pop_list_religion_icons[index].set_icon_index(pop_row[pop_religion_icon_key]) + # TODO - replace with actual religion + _pop_list_religion_icons[index].set_tooltip_string("Religion #%d" % pop_row[pop_religion_icon_key]) if _pop_list_location_labels[index]: - _pop_list_location_labels[index].set_text(GUINode.format_province_name(pop_row.get(pop_location_key, ""))) + var province_name : String = GUINode.format_province_name(pop_row.get(pop_location_key, "")) + _pop_list_location_labels[index].set_text(province_name) + _pop_list_location_labels[index].set_tooltip_string(province_name) if _pop_list_militancy_labels[index]: _pop_list_militancy_labels[index].set_text(GUINode.float_to_string_dp(pop_row[pop_militancy_key], 2)) + # TODO - test tooltip, add monthly change + source breakdown + _pop_list_militancy_labels[index].set_tooltip_string("POP_MIL_TOTAL") if _pop_list_consciousness_labels[index]: _pop_list_consciousness_labels[index].set_text(GUINode.float_to_string_dp(pop_row[pop_consciousness_key], 2)) + # TODO - test tooltip, add monthly change + source breakdown + _pop_list_consciousness_labels[index].set_tooltip_string("POP_CON_TOTAL") if _pop_list_ideology_charts[index]: _pop_list_ideology_charts[index].set_slices_array(pop_row[pop_ideology_key]) if _pop_list_issues_charts[index]: _pop_list_issues_charts[index].set_slices_array(pop_row[pop_issues_key]) if _pop_list_unemployment_progressbars[index]: - _pop_list_unemployment_progressbars[index].set_value_no_signal(pop_row[pop_unemployment_key]) + var unemployment : float = pop_row[pop_unemployment_key] + _pop_list_unemployment_progressbars[index].set_value_no_signal(unemployment) + _pop_list_unemployment_progressbars[index].set_tooltip_string("%s: §Y%s%%" % [ + tr("UNEMPLOYMENT"), GUINode.float_to_string_dp(unemployment * 100.0, 3) + ]) if _pop_list_cash_labels[index]: - _pop_list_cash_labels[index].set_text(GUINode.float_to_string_dp(pop_row[pop_cash_key], 2)) + _pop_list_cash_labels[index].set_text("%s¤" % GUINode.float_to_string_dp(pop_row[pop_cash_key], 2)) + _pop_list_cash_labels[index].set_tooltip_string_and_substitution_dict("POP_DAILY_MONEY", { + "VAL": GUINode.float_to_string_dp(1.23, 2) + }) if _pop_list_life_needs_progressbars[index]: - _pop_list_life_needs_progressbars[index].set_value_no_signal(pop_row[pop_life_needs_key]) + var life_needs : float = pop_row[pop_life_needs_key] + _pop_list_life_needs_progressbars[index].set_value_no_signal(life_needs) + _pop_list_life_needs_progressbars[index].set_tooltip_string_and_substitution_dict("GETTING_NEEDS", { + "NEED": "LIFE_NEEDS", "VAL": GUINode.float_to_string_dp(life_needs * 100.0, 1) + }) if _pop_list_everyday_needs_progressbars[index]: - _pop_list_everyday_needs_progressbars[index].set_value_no_signal(pop_row[pop_everyday_needs_key]) + var everyday_needs : float = pop_row[pop_everyday_needs_key] + _pop_list_everyday_needs_progressbars[index].set_value_no_signal(everyday_needs) + _pop_list_everyday_needs_progressbars[index].set_tooltip_string_and_substitution_dict("GETTING_NEEDS", { + "NEED": "EVERYDAY_NEEDS", "VAL": GUINode.float_to_string_dp(everyday_needs * 100.0, 1) + }) 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]: + var luxury_needs : float = pop_row[pop_luxury_needs_key] + _pop_list_luxury_needs_progressbars[index].set_value_no_signal(luxury_needs) + _pop_list_luxury_needs_progressbars[index].set_tooltip_string_and_substitution_dict("GETTING_NEEDS", { + "NEED": "LUXURY_NEEDS", "VAL": GUINode.float_to_string_dp(luxury_needs * 100.0, 1) + }) + 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])) + var pop_change : int = pop_row[pop_size_change_key] + _pop_list_size_change_icons[index].set_icon_index(get_growth_icon_index(pop_change)) + _pop_list_size_change_icons[index].set_tooltip_string("%s §%s%s" % [ + tr("POPULATION_CHANGED_BY"), "G+" if pop_change > 0 else "Y+" if pop_change == 0 else "R", str(pop_change) + ]) if _pop_list_literacy_labels[index]: _pop_list_literacy_labels[index].set_text("%s%%" % GUINode.float_to_string_dp(pop_row[pop_literacy_key], 2)) + _pop_list_literacy_labels[index].set_tooltip_string("%s: §G%s%%" % [ + tr("LIT_CHANGE"), GUINode.float_to_string_dp(pop_row[pop_literacy_key] / 64.0, 2) + ]) _pop_list_rows[index].show() else: 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)) |