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/BudgetMenu.gd | 34 ++++++++++++++++++++++ .../NationManagementScreen/DiplomacyMenu.gd | 34 ++++++++++++++++++++++ .../NationManagementScreen/MilitaryMenu.gd | 34 ++++++++++++++++++++++ .../NationManagementScreen/PoliticsMenu.gd | 34 ++++++++++++++++++++++ .../NationManagementScreen/PopulationMenu.gd | 34 ++++++++++++++++++++++ .../NationManagementScreen/ProductionMenu.gd | 34 ++++++++++++++++++++++ .../NationManagementScreen/TechnologyMenu.gd | 34 ++++++++++++++++++++++ .../NationManagementScreen/TradeMenu.gd | 34 ++++++++++++++++++++++ 8 files changed, 272 insertions(+) create mode 100644 game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd create mode 100644 game/src/Game/GameSession/NationManagementScreen/DiplomacyMenu.gd create mode 100644 game/src/Game/GameSession/NationManagementScreen/MilitaryMenu.gd create mode 100644 game/src/Game/GameSession/NationManagementScreen/PoliticsMenu.gd create mode 100644 game/src/Game/GameSession/NationManagementScreen/PopulationMenu.gd create mode 100644 game/src/Game/GameSession/NationManagementScreen/ProductionMenu.gd create mode 100644 game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd create mode 100644 game/src/Game/GameSession/NationManagementScreen/TradeMenu.gd (limited to 'game/src/Game/GameSession/NationManagementScreen') 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() -- cgit v1.2.3-56-ga3b1