aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/src/Game/Autoload/Events.gd6
-rw-r--r--game/src/Game/Autoload/Events/NationManagementScreens.gd25
-rw-r--r--game/src/Game/GameSession/GameSession.tscn50
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd34
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd34
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd34
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd34
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd34
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd34
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd34
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd34
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel.gd8
-rw-r--r--game/src/Game/GameSession/Topbar.gd41
-rw-r--r--game/src/Game/GameStart.gd2
-rw-r--r--game/src/Game/GlobalClass/NationManagement.gd13
15 files changed, 408 insertions, 9 deletions
diff --git a/game/src/Game/Autoload/Events.gd b/game/src/Game/Autoload/Events.gd
index 4f38f61..091a122 100644
--- a/game/src/Game/Autoload/Events.gd
+++ b/game/src/Game/Autoload/Events.gd
@@ -1,9 +1,11 @@
## Events are exclusively for the purpose of handling global signals
## This is to reduce "signal bubbling" which is when a signal callback is used to "bubble" the signal callbacks up the scene tree.
-## It does such by providing a global interface of signals that are connected to and emitted by that are garunteed to exist.
+## It does such by providing a global interface of signals that are connected to and emitted by that are guaranteed to exist.
extends Node
-var Options: OptionsEventsObject
+var Options : OptionsEventsObject
+var NationManagementScreens : NationManagementScreensEventsObject
func _init() -> void:
Options = OptionsEventsObject.new()
+ NationManagementScreens = NationManagementScreensEventsObject.new()
diff --git a/game/src/Game/Autoload/Events/NationManagementScreens.gd b/game/src/Game/Autoload/Events/NationManagementScreens.gd
new file mode 100644
index 0000000..4bdca6d
--- /dev/null
+++ b/game/src/Game/Autoload/Events/NationManagementScreens.gd
@@ -0,0 +1,25 @@
+class_name NationManagementScreensEventsObject
+extends RefCounted
+
+signal update_active_nation_management_screen(screen : NationManagement.Screen)
+
+var _current_screen : NationManagement.Screen = NationManagement.Screen.NONE
+
+# Set the current nation management screen. This emits an update signal to force
+# the argument screen to update, even if it was already the current screen.
+# Used by miscellaneous screen opening buttons (e.g. in province overview panel)
+# and by the close and toggle functions below.
+func open_nation_management_screen(screen : NationManagement.Screen) -> void:
+ _current_screen = screen
+ update_active_nation_management_screen.emit(_current_screen)
+
+# Close the screen if it is already open. Used for screens' close buttons.
+func close_nation_management_screen(screen : NationManagement.Screen) -> void:
+ if screen == _current_screen:
+ open_nation_management_screen(NationManagement.Screen.NONE)
+
+# Either switch to the screen or close it if it is already open. Used for topbar's buttons.
+func toggle_nation_management_screen(screen : NationManagement.Screen) -> void:
+ if screen == _current_screen:
+ screen = NationManagement.Screen.NONE
+ open_nation_management_screen(screen)
diff --git a/game/src/Game/GameSession/GameSession.tscn b/game/src/Game/GameSession/GameSession.tscn
index c7a8003..d2fc3a3 100644
--- a/game/src/Game/GameSession/GameSession.tscn
+++ b/game/src/Game/GameSession/GameSession.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=10 format=3 uid="uid://bgnupcshe1m7r"]
+[gd_scene load_steps=18 format=3 uid="uid://bgnupcshe1m7r"]
[ext_resource type="Script" path="res://src/Game/GameSession/GameSession.gd" id="1_eklvp"]
[ext_resource type="PackedScene" uid="uid://cvl76duuym1wq" path="res://src/Game/MusicConductor/MusicPlayer.tscn" id="2_kt6aa"]
@@ -6,9 +6,17 @@
[ext_resource type="PackedScene" uid="uid://dvdynl6eir40o" path="res://src/Game/GameSession/GameSessionMenu.tscn" id="3_bvmqh"]
[ext_resource type="Script" path="res://src/Game/GameSession/Topbar.gd" id="4_2kbih"]
[ext_resource type="PackedScene" uid="uid://dkehmdnuxih2r" path="res://src/Game/GameSession/MapView.tscn" id="4_xkg5j"]
+[ext_resource type="Script" path="res://src/Game/GameSession/NationManagementScreen/ProductionMenu.gd" id="5_16755"]
[ext_resource type="Script" path="res://src/Game/GameSession/ProvinceOverviewPanel.gd" id="5_lfv8l"]
[ext_resource type="PackedScene" uid="uid://cnbfxjy1m6wja" path="res://src/Game/Menu/OptionMenu/OptionsMenu.tscn" id="6_p5mnx"]
+[ext_resource type="Script" path="res://src/Game/GameSession/NationManagementScreen/BudgetMenu.gd" id="6_vninv"]
+[ext_resource type="Script" path="res://src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd" id="7_r712c"]
[ext_resource type="PackedScene" uid="uid://d3g6wbvwflmyk" path="res://src/Game/Menu/SaveLoadMenu/SaveLoadMenu.tscn" id="8_4g7ko"]
+[ext_resource type="Script" path="res://src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd" id="8_ppdek"]
+[ext_resource type="Script" path="res://src/Game/GameSession/NationManagementScreen/PopulationMenu.gd" id="10_laee7"]
+[ext_resource type="Script" path="res://src/Game/GameSession/NationManagementScreen/TradeMenu.gd" id="10_mv1r6"]
+[ext_resource type="Script" path="res://src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd" id="11_fu7ys"]
+[ext_resource type="Script" path="res://src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd" id="12_6h6nc"]
[node name="GameSession" type="Control" node_paths=PackedStringArray("_game_session_menu")]
editor_description = "SS-102, UI-546"
@@ -34,6 +42,46 @@ layout_mode = 1
anchors_preset = 15
script = ExtResource("4_2kbih")
+[node name="ProductionMenu" type="GUINode" parent="Topbar"]
+layout_mode = 1
+anchors_preset = 15
+script = ExtResource("5_16755")
+
+[node name="BudgetMenu" type="GUINode" parent="Topbar"]
+layout_mode = 1
+anchors_preset = 15
+script = ExtResource("6_vninv")
+
+[node name="TechnologyMenu" type="GUINode" parent="Topbar"]
+layout_mode = 1
+anchors_preset = 15
+script = ExtResource("7_r712c")
+
+[node name="PoliticsMenu" type="GUINode" parent="Topbar"]
+layout_mode = 1
+anchors_preset = 15
+script = ExtResource("8_ppdek")
+
+[node name="PopulationMenu" type="GUINode" parent="Topbar"]
+layout_mode = 1
+anchors_preset = 15
+script = ExtResource("10_laee7")
+
+[node name="TradeMenu" type="GUINode" parent="Topbar"]
+layout_mode = 1
+anchors_preset = 15
+script = ExtResource("10_mv1r6")
+
+[node name="DiplomacyMenu" type="GUINode" parent="Topbar"]
+layout_mode = 1
+anchors_preset = 15
+script = ExtResource("11_fu7ys")
+
+[node name="MilitaryMenu" type="GUINode" parent="Topbar"]
+layout_mode = 1
+anchors_preset = 15
+script = ExtResource("12_6h6nc")
+
[node name="MapControlPanel" parent="." instance=ExtResource("3_afh6d")]
layout_mode = 1
anchors_preset = 3
diff --git a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
new file mode 100644
index 0000000..7158333
--- /dev/null
+++ b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
@@ -0,0 +1,34 @@
+extends GUINode
+
+var _active : bool = false
+
+const _screen : NationManagement.Screen = NationManagement.Screen.BUDGET
+
+func _ready() -> void:
+ GameSingleton.gamestate_updated.connect(_update_info)
+
+ Events.NationManagementScreens.update_active_nation_management_screen.connect(_on_update_active_nation_management_screen)
+
+ add_gui_element("country_budget", "country_budget")
+
+ var close_button : Button = get_button_from_nodepath(^"./country_budget/close_button")
+ if close_button:
+ close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
+
+ _update_info()
+
+func _notification(what : int) -> void:
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
+
+func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
+ _active = active_screen == _screen
+ _update_info()
+
+func _update_info() -> void:
+ if _active:
+ # TODO - update UI state
+ show()
+ else:
+ hide()
diff --git a/game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd b/game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd
new file mode 100644
index 0000000..fb11a31
--- /dev/null
+++ b/game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd
@@ -0,0 +1,34 @@
+extends GUINode
+
+var _active : bool = false
+
+const _screen : NationManagement.Screen = NationManagement.Screen.DIPLOMACY
+
+func _ready() -> void:
+ GameSingleton.gamestate_updated.connect(_update_info)
+
+ Events.NationManagementScreens.update_active_nation_management_screen.connect(_on_update_active_nation_management_screen)
+
+ add_gui_element("country_diplomacy", "country_diplomacy")
+
+ var close_button : Button = get_button_from_nodepath(^"./country_diplomacy/close_button")
+ if close_button:
+ close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
+
+ _update_info()
+
+func _notification(what : int) -> void:
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
+
+func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
+ _active = active_screen == _screen
+ _update_info()
+
+func _update_info() -> void:
+ if _active:
+ # TODO - update UI state
+ show()
+ else:
+ hide()
diff --git a/game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd b/game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd
new file mode 100644
index 0000000..f3cc486
--- /dev/null
+++ b/game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd
@@ -0,0 +1,34 @@
+extends GUINode
+
+var _active : bool = false
+
+const _screen : NationManagement.Screen = NationManagement.Screen.MILITARY
+
+func _ready() -> void:
+ GameSingleton.gamestate_updated.connect(_update_info)
+
+ Events.NationManagementScreens.update_active_nation_management_screen.connect(_on_update_active_nation_management_screen)
+
+ add_gui_element("country_military", "country_military")
+
+ var close_button : Button = get_button_from_nodepath(^"./country_military/close_button")
+ if close_button:
+ close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
+
+ _update_info()
+
+func _notification(what : int) -> void:
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
+
+func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
+ _active = active_screen == _screen
+ _update_info()
+
+func _update_info() -> void:
+ if _active:
+ # TODO - update UI state
+ show()
+ else:
+ hide()
diff --git a/game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd b/game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd
new file mode 100644
index 0000000..7237bf5
--- /dev/null
+++ b/game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd
@@ -0,0 +1,34 @@
+extends GUINode
+
+var _active : bool = false
+
+const _screen : NationManagement.Screen = NationManagement.Screen.POLITICS
+
+func _ready() -> void:
+ GameSingleton.gamestate_updated.connect(_update_info)
+
+ Events.NationManagementScreens.update_active_nation_management_screen.connect(_on_update_active_nation_management_screen)
+
+ add_gui_element("country_politics", "country_politics")
+
+ var close_button : Button = get_button_from_nodepath(^"./country_politics/close_button")
+ if close_button:
+ close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
+
+ _update_info()
+
+func _notification(what : int) -> void:
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
+
+func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
+ _active = active_screen == _screen
+ _update_info()
+
+func _update_info() -> void:
+ if _active:
+ # TODO - update UI state
+ show()
+ else:
+ hide()
diff --git a/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
new file mode 100644
index 0000000..29bd56b
--- /dev/null
+++ b/game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd
@@ -0,0 +1,34 @@
+extends GUINode
+
+var _active : bool = false
+
+const _screen : NationManagement.Screen = NationManagement.Screen.POPULATION
+
+func _ready() -> void:
+ GameSingleton.gamestate_updated.connect(_update_info)
+
+ Events.NationManagementScreens.update_active_nation_management_screen.connect(_on_update_active_nation_management_screen)
+
+ add_gui_element("country_pops", "country_pop")
+
+ var close_button : Button = get_button_from_nodepath(^"./country_pop/close_button")
+ if close_button:
+ close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
+
+ _update_info()
+
+func _notification(what : int) -> void:
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
+
+func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
+ _active = active_screen == _screen
+ _update_info()
+
+func _update_info() -> void:
+ if _active:
+ # TODO - update UI state
+ show()
+ else:
+ hide()
diff --git a/game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd b/game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd
new file mode 100644
index 0000000..938f8e7
--- /dev/null
+++ b/game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd
@@ -0,0 +1,34 @@
+extends GUINode
+
+var _active : bool = false
+
+const _screen : NationManagement.Screen = NationManagement.Screen.PRODUCTION
+
+func _ready() -> void:
+ GameSingleton.gamestate_updated.connect(_update_info)
+
+ Events.NationManagementScreens.update_active_nation_management_screen.connect(_on_update_active_nation_management_screen)
+
+ add_gui_element("country_production", "country_production")
+
+ var close_button : Button = get_button_from_nodepath(^"./country_production/close_button")
+ if close_button:
+ close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
+
+ _update_info()
+
+func _notification(what : int) -> void:
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
+
+func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
+ _active = active_screen == _screen
+ _update_info()
+
+func _update_info() -> void:
+ if _active:
+ # TODO - update UI state
+ show()
+ else:
+ hide()
diff --git a/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd b/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd
new file mode 100644
index 0000000..a80ed1e
--- /dev/null
+++ b/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd
@@ -0,0 +1,34 @@
+extends GUINode
+
+var _active : bool = false
+
+const _screen : NationManagement.Screen = NationManagement.Screen.TECHNOLOGY
+
+func _ready() -> void:
+ GameSingleton.gamestate_updated.connect(_update_info)
+
+ Events.NationManagementScreens.update_active_nation_management_screen.connect(_on_update_active_nation_management_screen)
+
+ add_gui_element("country_technology", "country_technology")
+
+ var close_button : Button = get_button_from_nodepath(^"./country_technology/close_button")
+ if close_button:
+ close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
+
+ _update_info()
+
+func _notification(what : int) -> void:
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
+
+func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
+ _active = active_screen == _screen
+ _update_info()
+
+func _update_info() -> void:
+ if _active:
+ # TODO - update UI state
+ show()
+ else:
+ hide()
diff --git a/game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd b/game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd
new file mode 100644
index 0000000..775f31a
--- /dev/null
+++ b/game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd
@@ -0,0 +1,34 @@
+extends GUINode
+
+var _active : bool = false
+
+const _screen : NationManagement.Screen = NationManagement.Screen.TRADE
+
+func _ready() -> void:
+ GameSingleton.gamestate_updated.connect(_update_info)
+
+ Events.NationManagementScreens.update_active_nation_management_screen.connect(_on_update_active_nation_management_screen)
+
+ add_gui_element("country_trade", "country_trade")
+
+ var close_button : Button = get_button_from_nodepath(^"./country_trade/close_button")
+ if close_button:
+ close_button.pressed.connect(Events.NationManagementScreens.close_nation_management_screen.bind(_screen))
+
+ _update_info()
+
+func _notification(what : int) -> void:
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
+
+func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
+ _active = active_screen == _screen
+ _update_info()
+
+func _update_info() -> void:
+ if _active:
+ # TODO - update UI state
+ show()
+ else:
+ hide()
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel.gd b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
index 6fe28d7..cb76241 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel.gd
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
@@ -121,7 +121,7 @@ func _ready() -> void:
GameSingleton.province_selected.connect(_on_province_selected)
GameSingleton.gamestate_updated.connect(_update_info)
- if add_gui_element("province_interface.gui", "province_view") != OK:
+ if add_gui_element("province_interface", "province_view") != OK:
push_error("Failed to generate province overview panel!")
return
@@ -144,7 +144,7 @@ func _ready() -> void:
_administrative_percentage_label = get_label_from_nodepath(^"./province_view/province_view_header/admin_efficiency")
_owner_percentage_label = get_label_from_nodepath(^"./province_view/province_view_header/owner_presence")
_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.gui", "prov_state_modifier") != OK:
+ 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_icon_texture_from_nodepath(^"./province_view/province_view_header/prov_terrain")
_life_rating_bar = get_progress_bar_from_nodepath(^"./province_view/province_view_header/liferating")
@@ -168,7 +168,7 @@ func _ready() -> void:
_pop_cultures_piechart = get_gfx_pie_chart_texture_from_nodepath(^"./province_view/province_statistics/culture_chart")
_supply_limit_label = get_label_from_nodepath(^"./province_view/province_statistics/supply_limit_label")
_cores_overlapping_elements_box = get_gui_overlapping_elements_box_from_nodepath(^"./province_view/province_statistics/core_icons")
- if _cores_overlapping_elements_box and _cores_overlapping_elements_box.set_gui_child_element_name("province_interface.gui", "province_core") != OK:
+ if _cores_overlapping_elements_box and _cores_overlapping_elements_box.set_gui_child_element_name("province_interface", "province_core") != OK:
_cores_overlapping_elements_box = null # hide cores box since we can't do anything with it
_buildings_panel = get_panel_from_nodepath(^"./province_view/province_buildings")
@@ -176,7 +176,7 @@ func _ready() -> void:
var target_slot_count : int = GameSingleton.get_province_building_count()
var slot_y : float = 0.0
for current_slot_count : int in target_slot_count:
- var slot := GUINode.generate_gui_element("province_interface.gui", "building", "building_slot_%d" % current_slot_count)
+ var slot := GUINode.generate_gui_element("province_interface", "building", "building_slot_%d" % current_slot_count)
if slot:
_buildings_panel.add_child(slot)
slot.set_position(Vector2(0.0, slot_y))
diff --git a/game/src/Game/GameSession/Topbar.gd b/game/src/Game/GameSession/Topbar.gd
index 05eb985..3cfc0e6 100644
--- a/game/src/Game/GameSession/Topbar.gd
+++ b/game/src/Game/GameSession/Topbar.gd
@@ -1,5 +1,7 @@
extends GUINode
+@export var _outliner_guinode : GUINode
+
var _speed_up_button : Button
var _speed_down_button : Button
var _speed_indicator_button : Button
@@ -7,11 +9,16 @@ var _speed_indicator_texture : GFXIconTexture
var _date_label : Label
var _country_name_label : Label
+# NationManagement.Screen-Button
+var _nation_management_buttons : Dictionary
+# NationManagement.Screen-GFXIconTexture
+var _nation_management_button_textures : Dictionary
+
func _ready() -> void:
GameSingleton.gamestate_updated.connect(_update_info)
GameSingleton.clock_state_changed.connect(_update_speed_controls)
- add_gui_element("topbar.gui", "topbar")
+ add_gui_element("topbar", "topbar")
hide_nodes([
^"./topbar/topbar_outlinerbutton_bg",
@@ -20,10 +27,12 @@ func _ready() -> void:
const player_country : String = "SLV"
+ # Player country info
var player_flag_texture : GFXMaskedFlagTexture = get_gfx_masked_flag_texture_from_nodepath(^"./topbar/player_flag")
if player_flag_texture:
player_flag_texture.set_flag_country_name(player_country)
+ # Time controls
_speed_up_button = get_button_from_nodepath(^"./topbar/button_speedup")
if _speed_up_button:
_speed_up_button.pressed.connect(_on_increase_speed_button_pressed)
@@ -47,6 +56,31 @@ func _ready() -> void:
_speed_indicator_button.pressed.connect(_on_play_pause_button_pressed)
_speed_indicator_texture = GUINode.get_gfx_icon_texture_from_node(_speed_indicator_button)
+ # Nation management screens
+ const screen_nodepaths : Dictionary = {
+ NationManagement.Screen.PRODUCTION : ^"./topbar/topbarbutton_production",
+ NationManagement.Screen.BUDGET : ^"./topbar/topbarbutton_budget",
+ NationManagement.Screen.TECHNOLOGY : ^"./topbar/topbarbutton_tech",
+ NationManagement.Screen.POLITICS : ^"./topbar/topbarbutton_politics",
+ NationManagement.Screen.POPULATION : ^"./topbar/topbarbutton_pops",
+ NationManagement.Screen.TRADE : ^"./topbar/topbarbutton_trade",
+ NationManagement.Screen.DIPLOMACY : ^"./topbar/topbarbutton_diplomacy",
+ NationManagement.Screen.MILITARY : ^"./topbar/topbarbutton_military"
+ }
+ for screen in screen_nodepaths:
+ var button : Button = get_button_from_nodepath(screen_nodepaths[screen])
+ if button:
+ button.pressed.connect(
+ Events.NationManagementScreens.toggle_nation_management_screen.bind(screen)
+ )
+ var icon : GFXIconTexture = get_gfx_icon_texture_from_node(button)
+ if icon:
+ _nation_management_buttons[screen] = button
+ _nation_management_button_textures[screen] = icon
+ Events.NationManagementScreens.update_active_nation_management_screen.connect(
+ _on_update_active_nation_management_screen
+ )
+
_update_info()
_update_speed_controls()
@@ -92,3 +126,8 @@ func _on_increase_speed_button_pressed() -> void:
func _on_decrease_speed_button_pressed() -> void:
print("Speed down!")
GameSingleton.decrease_speed()
+
+func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
+ for screen in _nation_management_buttons:
+ _nation_management_button_textures[screen].set_icon_index(1 + int(screen == active_screen))
+ _nation_management_buttons[screen].queue_redraw()
diff --git a/game/src/Game/GameStart.gd b/game/src/Game/GameStart.gd
index 7a52846..0aadbb9 100644
--- a/game/src/Game/GameStart.gd
+++ b/game/src/Game/GameStart.gd
@@ -48,7 +48,7 @@ func _save_setting(file : ConfigFile) -> void:
func _setup_compatibility_mode_paths() -> void:
# To test mods, set your base path to Victoria II and then pass mods in reverse order with --mod="mod" for each mod.
-
+
var arg_base_path : String = ArgumentParser.get_argument(&"base-path", "")
var arg_search_path : String = ArgumentParser.get_argument(&"search-path", "")
diff --git a/game/src/Game/GlobalClass/NationManagement.gd b/game/src/Game/GlobalClass/NationManagement.gd
new file mode 100644
index 0000000..3b73bde
--- /dev/null
+++ b/game/src/Game/GlobalClass/NationManagement.gd
@@ -0,0 +1,13 @@
+class_name NationManagement
+
+enum Screen {
+ NONE,
+ PRODUCTION,
+ BUDGET,
+ TECHNOLOGY,
+ POLITICS,
+ POPULATION,
+ TRADE,
+ DIPLOMACY,
+ MILITARY
+}