diff options
Diffstat (limited to 'game')
-rw-r--r-- | game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd b/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd index 7c8dfef..b9d78f6 100644 --- a/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd +++ b/game/src/Game/GameSession/NationManagementScreen/TechnologyMenu.gd @@ -12,24 +12,22 @@ var tech_groups = [] var tech_window : Control = generate_gui_element("country_technology", "tech_window") var tech_windows = generate_tech_windows(5,6) -var tech_folder_dict : Dictionary -var tech_area_dict : Dictionary -var tech_dict : Dictionary +#populate godot dictionaries from the simulation backend +var tech_folder_dict : Dictionary = GameSingleton.get_tech_folders() +var tech_area_dict : Dictionary = GameSingleton.get_tech_areas() +var tech_dict : Dictionary = GameSingleton.get_technologies() func _ready() -> void: - tech_folder_dict = GameSingleton.get_tech_folders() - tech_area_dict = GameSingleton.get_tech_areas() - tech_dict = GameSingleton.get_technologies() GameSingleton.gamestate_updated.connect(_update_info) add_child(country_technology) Events.NationManagementScreens.update_active_nation_management_screen.connect(_on_update_active_nation_management_screen) + + generate_interface() - #in vic2, army tech is the initial window selected - var selected_tech_window = folder_windows[0] #setup the window since the gui file doesnt store positions, can probably be optimised for folder_item in folder_windows: country_technology.add_child(folder_item) @@ -42,6 +40,9 @@ func _ready() -> void: country_technology.add_child(research_item_row) tech_windows.clear() + #in vic2, army tech is the initial window selected + populate_areas("army_tech") + var close_button : Button = get_button_from_nodepath(^"./country_technology/close_button") if close_button: @@ -69,7 +70,8 @@ func generate_interface(): #generate the initial UI elements for i in 5: var temp = folder_window.duplicate() - temp.name = temp.name+str(i) + temp.name = tech_folder_dict[i].identifier + temp.get_child(2).text = tech_folder_dict[i].identifier temp.position.x = 28+(194*i) temp.position.y = 55 folder_windows.append(temp) @@ -79,6 +81,42 @@ func generate_interface(): temp.position.x = 28+(194*i) temp.position.y = 107 tech_groups.append(temp) + +func populate_areas(identifier): + var offset + match identifier: + "army_tech": + offset = 0 + "navy_tech": + offset = 5 + "commerce_tech": + offset = 10 + "culture_tech": + offset = 15 + "industry_tech": + offset = 20 + for i in 5: + var node = get_node("/root/GameSession/Topbar/TechnologyMenu/country_technology/tech_group"+str(i)) + node.get_child(0).text = tech_area_dict[offset+i].identifier + populate_techs(identifier) + +func populate_techs(identifier): + var offset + match identifier: + "army_tech": + offset = 0 + "navy_tech": + offset = 30 + "commerce_tech": + offset = 60 + "culture_tech": + offset = 90 + "industry_tech": + offset = 120 + for x in 5: + for y in 6: + var node = get_node("/root/GameSession/Topbar/TechnologyMenu/country_technology/tech_window"+str(x)+"_"+str(y)) + node.get_child(1).text = tech_dict[offset+x+y].identifier func generate_tech_windows(x,y): var matrix = [] |