aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/Menu/LobbyMenu
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-12-23 05:01:51 +0100
committer George L. Albany <Megacake1234@gmail.com>2023-12-24 04:52:36 +0100
commitb6413251a866c76538869b84ed1c9b9852f7c507 (patch)
tree1b99c935438692bb2ebadeac412b990c82089b65 /game/src/Game/Menu/LobbyMenu
parent50b0b935b0bf0724f40b5140aca85d1830a8b1b3 (diff)
Apply type hints to menu scripts
Diffstat (limited to 'game/src/Game/Menu/LobbyMenu')
-rw-r--r--game/src/Game/Menu/LobbyMenu/LobbyMenu.gd26
-rw-r--r--game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd10
2 files changed, 18 insertions, 18 deletions
diff --git a/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd b/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd
index 3c857fe..cc681ba 100644
--- a/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd
+++ b/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd
@@ -46,7 +46,7 @@ var _id_to_tag : Array[StringName] = []
# * FS-8
func _build_save_list() -> void:
game_select_save_tab.add_tab("GAMELOBBY_SELECT_ALL")
- for save_name in SaveManager._save_dictionary:
+ for save_name : StringName in SaveManager._save_dictionary:
var save : SaveResource = SaveManager._save_dictionary[save_name]
var save_node := _create_save_node(save)
game_select_save_list.add_child(save_node)
@@ -55,16 +55,16 @@ func _build_save_list() -> void:
game_select_save_tab.add_tab(save.session_tag)
func _create_save_node(resource : SaveResource) -> Control:
- var save_node = save_scene.instantiate()
+ var save_node := save_scene.instantiate()
save_node.resource = resource
save_node.pressed.connect(_on_save_node_pressed.bind(save_node))
save_node.request_to_delete.connect(_on_save_node_delete_requested.bind(save_node))
return save_node
func _queue_clear_lists() -> void:
- var full_list = game_select_start_date.get_children()
+ var full_list := game_select_start_date.get_children()
full_list.append_array(game_select_save_list.get_children())
- for child in full_list:
+ for child : Node in full_list:
child.queue_free()
game_select_save_tab.clear_tabs()
_id_to_tag.clear()
@@ -72,7 +72,7 @@ func _queue_clear_lists() -> void:
# REQUIREMENTS:
# * SS-16
# * UIFUN-40
-func _on_back_button_button_down():
+func _on_back_button_button_down() -> void:
print("Returning to Main Menu.")
SaveManager.current_session_tag = ""
SaveManager.current_save = null
@@ -80,7 +80,7 @@ func _on_back_button_button_down():
# REQUIREMENTS:
# * SS-21
-func _on_start_button_pressed():
+func _on_start_button_pressed() -> void:
print("Starting new game.")
if SaveManager.current_session_tag == "":
# TODO: Get country tag as well
@@ -102,20 +102,20 @@ func _on_start_button_pressed():
# REQUIREMENTS:
# * SS-19
-func _on_game_select_list_item_selected(index):
+func _on_game_select_list_item_selected(index) -> void:
print("Selected save game: ", index)
save_game_selected.emit(index)
# If the date is double-clicked, start the game!
-func _on_game_select_list_item_activated(index):
+func _on_game_select_list_item_activated(index) -> void:
_on_game_select_list_item_selected(index)
_on_start_button_pressed()
-func _on_session_tag_edit_text_submitted(new_text):
+func _on_session_tag_edit_text_submitted(new_text : String) -> void:
SaveManager.current_session_tag = new_text
_on_start_button_pressed()
-func _on_session_tag_dialog_confirmed():
+func _on_session_tag_dialog_confirmed() -> void:
get_tree().change_scene_to_file("res://src/Game/GameSession/GameSession.tscn")
var _requested_node_to_delete : Control
@@ -147,17 +147,17 @@ func _on_save_node_pressed(node : Control) -> void:
start_button.disabled = false
save_game_selected.emit(SaveManager.current_save)
-func _on_game_select_save_tab_tab_changed(tab) -> void:
+func _on_game_select_save_tab_tab_changed(tab : int) -> void:
if tab == 0:
filter_for_tag(&"")
else:
filter_for_tag(_id_to_tag[tab - 1])
-func _on_delete_dialog_confirmed():
+func _on_delete_dialog_confirmed() -> void:
_requested_node_to_delete.resource.delete()
_requested_node_to_delete.queue_free()
-func _on_visibility_changed():
+func _on_visibility_changed() -> void:
if visible:
_build_date_list()
_build_save_list()
diff --git a/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd b/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd
index 5f3ea46..646c694 100644
--- a/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd
+++ b/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd
@@ -73,7 +73,7 @@ func _get_draw_mode_style() -> StyleBox:
return background_button.get_theme_stylebox(_get_draw_mode_name(false))
return result
-func _notification(what) -> void:
+func _notification(what : int) -> void:
if what == NOTIFICATION_SORT_CHILDREN:
var _size := size
var offset := Vector2()
@@ -89,14 +89,14 @@ func _notification(what) -> void:
fit_child_in_rect(child, Rect2(offset, _size))
-func _on_background_button_button_down():
+func _on_background_button_button_down() -> void:
button_down.emit()
-func _on_background_button_button_up():
+func _on_background_button_button_up() -> void:
button_up.emit()
-func _on_background_button_pressed():
+func _on_background_button_pressed() -> void:
pressed.emit()
-func _on_background_button_toggled(button_pressed : bool):
+func _on_background_button_toggled(button_pressed : bool) -> void:
toggled.emit(button_pressed)