From 1455861632cd50f48f6e8ef8c50004087eff36f1 Mon Sep 17 00:00:00 2001 From: hop311 Date: Fri, 2 Feb 2024 20:19:21 +0000 Subject: Basic Nation Management Screen framework --- .../NationManagementScreen/MilitaryMenu.gd | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd (limited to 'game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd') 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() -- cgit v1.2.3-56-ga3b1