diff options
author | Hop311 <Hop3114@gmail.com> | 2024-03-04 23:51:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 23:51:41 +0100 |
commit | eaae420cd2aca224d15f6276624c2fab882c978a (patch) | |
tree | bacc8f4094eff5514a94b3852e9cec9c28391669 /game/src/Game/Menu/OptionMenu | |
parent | 521f7d3d156f42535fb7574fb36f2726e9d13885 (diff) | |
parent | e2077a0d93be8b2dd48f1ee680809420f1f690d7 (diff) |
Merge pull request #211 from OpenVicProject/for-loop-types
Add types to GDScript for-loop variables
Diffstat (limited to 'game/src/Game/Menu/OptionMenu')
5 files changed, 8 insertions, 8 deletions
diff --git a/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd b/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd index 3be8c2c..f3c7b22 100644 --- a/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd +++ b/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd @@ -8,7 +8,7 @@ extends SettingOptionButton var default_value : float = GuiScale.error_guiscale func _find_guiscale_index_by_value(value : float) -> int: - for item_index in item_count: + for item_index : int in item_count: if get_item_metadata(item_index) == value: return item_index return -1 diff --git a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd index a535f17..44f89f0 100644 --- a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd +++ b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd @@ -2,7 +2,7 @@ extends SettingRevertButton func _setup_button() -> void: clear() - for screen_index in DisplayServer.get_screen_count(): + for screen_index : int in DisplayServer.get_screen_count(): # Placeholder option text awaiting _update_monitor_options_text() add_item(str(screen_index + 1)) _update_monitor_options_text() @@ -14,7 +14,7 @@ func _notification(what : int) -> void: _update_monitor_options_text() func _update_monitor_options_text() -> void: - for index in get_item_count(): + for index : int in get_item_count(): set_item_text(index, tr("OPTIONS_VIDEO_MONITOR").format({ "index": Localisation.tr_number(index + 1) })) func _on_option_selected(index : int, by_user : bool) -> void: diff --git a/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd index 1a21211..dfaae37 100644 --- a/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd +++ b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd @@ -6,7 +6,7 @@ extends SettingRevertButton @export var default_value : Vector2i = Resolution.error_resolution func _find_resolution_index_by_value(value : Vector2i) -> int: - for item_index in item_count: + for item_index : int in item_count: if get_item_metadata(item_index) == value: return item_index return -1 @@ -16,7 +16,7 @@ func _sync_resolutions() -> void: default_selected = -1 selected = -1 var current_resolution := Resolution.get_current_resolution() - for resolution_value in Resolution.get_resolution_value_list(): + for resolution_value : Vector2i in Resolution.get_resolution_value_list(): # Placeholder option text awaiting _update_resolution_options_text() add_item(str(resolution_value)) set_item_metadata(item_count - 1, resolution_value) @@ -40,7 +40,7 @@ func _notification(what : int) -> void: _update_resolution_options_text() func _update_resolution_options_text() -> void: - for index in get_item_count(): + for index : int in get_item_count(): var resolution_value : Vector2i = get_item_metadata(index) var format_dict := { "width": resolution_value.x, "height": resolution_value.y } format_dict["name"] = tr("OPTIONS_VIDEO_RESOLUTION_{width}x{height}".format(format_dict)) diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd index a972ed6..44bcada 100644 --- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd +++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd @@ -40,7 +40,7 @@ func _set_value_from_file(load_value : Variant) -> void: if _valid_index(load_int): selected = load_int return - for item_index in item_count: + for item_index : int in item_count: if load_string == get_item_text(item_index): selected = item_index return diff --git a/game/src/Game/Menu/OptionMenu/VolumeGrid.gd b/game/src/Game/Menu/OptionMenu/VolumeGrid.gd index cce231f..e9c59d5 100644 --- a/game/src/Game/Menu/OptionMenu/VolumeGrid.gd +++ b/game/src/Game/Menu/OptionMenu/VolumeGrid.gd @@ -40,7 +40,7 @@ func add_volume_row(bus_name : String, bus_index : int) -> HSlider: # REQUIREMENTS # * UI-22 func _ready() -> void: - for bus_index in AudioServer.bus_count: + for bus_index : int in AudioServer.bus_count: add_volume_row(AudioServer.get_bus_name(bus_index), bus_index) func _notification(what : int) -> void: |