aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-02-19 21:35:07 +0100
committer GitHub <noreply@github.com>2024-02-19 21:35:07 +0100
commit275cfbb62fe69828aeb9968110ad822447322a4e (patch)
tree15fe433ba9259623e2cb90a0ea7ae6a5c2f364b8 /game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd
parente4de451ce753dd8786546b9e2c94c579c8dab52e (diff)
parent1455861632cd50f48f6e8ef8c50004087eff36f1 (diff)
Merge pull request #202 from OpenVicProject/nation-management-screens
Basic Nation Management Screen framework
Diffstat (limited to 'game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd')
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd34
1 files changed, 34 insertions, 0 deletions
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()