aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-03-05 01:19:27 +0100
committer hop311 <hop3114@gmail.com>2024-03-05 10:36:47 +0100
commit444134a93bd5c704f5201ff30371dc81d0669e46 (patch)
tree851a3ad589bab71364d4c6adcb1ee30235abc2c7 /game
parenteaae420cd2aca224d15f6276624c2fab882c978a (diff)
Move GDExtension menu-related functions to MenuSingletonmenu-singleton
Diffstat (limited to 'game')
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel.gd14
-rw-r--r--game/src/Game/GameSession/Topbar.gd16
2 files changed, 15 insertions, 15 deletions
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel.gd b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
index 54591a3..731d02c 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel.gd
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
@@ -60,7 +60,7 @@ class BuildingSlot:
return
_slot_node = new_slot_node
- for icon_index : int in GameSingleton.get_province_building_count():
+ for icon_index : int in MenuSingleton.get_province_building_count():
var icon := _slot_node.get_node("build_icon%d" % icon_index)
if icon:
if icon_index == _slot_index:
@@ -70,10 +70,10 @@ class BuildingSlot:
var building_name := GUINode.get_label_from_node(_slot_node.get_node(^"./description"))
if building_name:
- building_name.text = GameSingleton.get_province_building_identifier(_slot_index)
+ building_name.text = MenuSingleton.get_province_building_identifier(_slot_index)
_expand_button = GUINode.get_button_from_node(_slot_node.get_node(^"./expand"))
if _expand_button:
- _expand_button.pressed.connect(func() -> void: GameSingleton.expand_selected_province_building(_slot_index))
+ _expand_button.pressed.connect(func() -> void: MenuSingleton.expand_selected_province_building(_slot_index))
_expanding_icon = GUINode.get_texture_rect_from_node(_slot_node.get_node(^"./underconstruction_icon"))
_expanding_progress_bar = GUINode.get_progress_bar_from_node(_slot_node.get_node(^"./building_progress"))
if _expanding_progress_bar:
@@ -135,12 +135,12 @@ func _ready() -> void:
_slave_status_icon = get_texture_rect_from_nodepath(^"./province_view/province_view_header/slave_state_icon")
var slave_status_icon_texture : GFXSpriteTexture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_view_header/slave_state_icon")
if slave_status_icon_texture:
- slave_status_icon_texture.set_icon_index(GameSingleton.get_slave_pop_icon_index())
+ slave_status_icon_texture.set_icon_index(MenuSingleton.get_slave_pop_icon_index())
_colony_status_button = get_button_from_nodepath(^"./province_view/province_view_header/colony_button")
_colony_status_button_texture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_view_header/colony_button")
var admin_icon_texture : GFXSpriteTexture = get_gfx_sprite_texture_from_nodepath(^"./province_view/province_view_header/admin_icon")
if admin_icon_texture:
- admin_icon_texture.set_icon_index(GameSingleton.get_administrative_pop_icon_index())
+ admin_icon_texture.set_icon_index(MenuSingleton.get_administrative_pop_icon_index())
_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")
@@ -173,7 +173,7 @@ func _ready() -> void:
_buildings_panel = get_panel_from_nodepath(^"./province_view/province_buildings")
if _buildings_panel:
- var target_slot_count : int = GameSingleton.get_province_building_count()
+ var target_slot_count : int = MenuSingleton.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", "building", "building_slot_%d" % current_slot_count)
@@ -247,7 +247,7 @@ func _update_info() -> void:
const _missing_suffix : String = "_MISSING"
- _province_info = GameSingleton.get_province_info_from_index(_selected_index)
+ _province_info = MenuSingleton.get_province_info_from_index(_selected_index)
if _province_info:
# Header
if _province_name_label:
diff --git a/game/src/Game/GameSession/Topbar.gd b/game/src/Game/GameSession/Topbar.gd
index b61af28..92ee75a 100644
--- a/game/src/Game/GameSession/Topbar.gd
+++ b/game/src/Game/GameSession/Topbar.gd
@@ -91,40 +91,40 @@ func _notification(what : int) -> void:
func _update_info() -> void:
if _date_label:
- _date_label.text = GameSingleton.get_longform_date()
+ _date_label.text = MenuSingleton.get_longform_date()
func _update_speed_controls() -> void:
# TODO - decide whether to disable these or not
# (they don't appear to get disabled in the base game)
#if _speed_up_button:
- # _speed_up_button.disabled = not GameSingleton.can_increase_speed()
+ # _speed_up_button.disabled = not MenuSingleton.can_increase_speed()
#if _speed_down_button:
- # _speed_down_button.disabled = not GameSingleton.can_decrease_speed()
+ # _speed_down_button.disabled = not MenuSingleton.can_decrease_speed()
if _speed_indicator_button and _speed_indicator_texture:
var index : int = 1
- if not GameSingleton.is_paused():
- index += GameSingleton.get_speed() + 1
+ if not MenuSingleton.is_paused():
+ index += MenuSingleton.get_speed() + 1
_speed_indicator_texture.set_icon_index(index)
# REQUIREMENTS:
# * UIFUN-71
func _on_play_pause_button_pressed() -> void:
print("Toggling pause!")
- GameSingleton.toggle_paused()
+ MenuSingleton.toggle_paused()
# REQUIREMENTS:
# * UIFUN-72
func _on_increase_speed_button_pressed() -> void:
print("Speed up!")
- GameSingleton.increase_speed()
+ MenuSingleton.increase_speed()
# REQUIREMENTS:
# * UIFUN-73
func _on_decrease_speed_button_pressed() -> void:
print("Speed down!")
- GameSingleton.decrease_speed()
+ MenuSingleton.decrease_speed()
func _on_update_active_nation_management_screen(active_screen : NationManagement.Screen) -> void:
for screen : NationManagement.Screen in _nation_management_buttons: