diff options
Diffstat (limited to 'game/src/Game/Menu/OptionMenu')
14 files changed, 41 insertions, 41 deletions
diff --git a/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd b/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd index 42be5e0..3be8c2c 100644 --- a/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd +++ b/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd @@ -17,7 +17,7 @@ func _sync_guiscales(to_select : float = GuiScale.get_current_guiscale()) -> voi clear() default_selected = -1 selected = -1 - for guiscale_value in GuiScale.get_guiscale_value_list(): + for guiscale_value : float in GuiScale.get_guiscale_value_list(): add_item(GuiScale.get_guiscale_display_name(guiscale_value)) set_item_metadata(item_count - 1, guiscale_value) @@ -33,7 +33,7 @@ func _sync_guiscales(to_select : float = GuiScale.get_current_guiscale()) -> voi if selected == -1: selected = default_selected -func _setup_button(): +func _setup_button() -> void: if default_value <= 0: default_value = ProjectSettings.get_setting("display/window/stretch/scale") GuiScale.add_guiscale(default_value, &"default") @@ -45,7 +45,7 @@ func _get_value_for_file(select_value : int): else: return null -func _set_value_from_file(load_value): +func _set_value_from_file(load_value : Variant) -> void: if typeof(load_value) == TYPE_FLOAT: var target_guiscale : float = load_value selected = _find_guiscale_index_by_value(target_guiscale) @@ -56,7 +56,7 @@ func _set_value_from_file(load_value): push_error("Setting value '%s' invalid for setting [%s] %s" % [load_value, section_name, setting_name]) selected = default_selected -func _on_option_selected(index : int, by_user : bool): +func _on_option_selected(index : int, by_user : bool) -> void: if _valid_index(index): GuiScale.set_guiscale(get_item_metadata(index)) else: diff --git a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd index c3beaf6..a535f17 100644 --- a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd +++ b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd @@ -8,7 +8,7 @@ func _setup_button() -> void: _update_monitor_options_text() default_selected = Resolution.get_current_monitor() -func _notification(what : int): +func _notification(what : int) -> void: match what: NOTIFICATION_TRANSLATION_CHANGED: _update_monitor_options_text() diff --git a/game/src/Game/Menu/OptionMenu/OptionsMenu.gd b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd index 93ef3e4..2b70d1c 100644 --- a/game/src/Game/Menu/OptionMenu/OptionsMenu.gd +++ b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd @@ -7,7 +7,7 @@ signal back_button_pressed @export var _tab_container : TabContainer -func _ready(): +func _ready() -> void: _tab_container.set_tab_title(0, "OPTIONS_GENERAL") _tab_container.set_tab_title(1, "OPTIONS_VIDEO") _tab_container.set_tab_title(2, "OPTIONS_SOUND") @@ -41,19 +41,19 @@ func _ready(): button_list.add_child(back_button) get_viewport().get_window().close_requested.connect(_on_window_close_requested) _save_overrides.call_deferred() - Events.Options.save_settings.connect(func(_f): self._save_overrides.call_deferred()) + Events.Options.save_settings.connect(func(_f : ConfigFile) -> void: self._save_overrides.call_deferred()) -func _notification(what): +func _notification(what : int) -> void: match what: NOTIFICATION_CRASH: _on_window_close_requested() -func _input(event): +func _input(event : InputEvent) -> void: if self.is_visible_in_tree(): if event.is_action_pressed("ui_cancel"): _on_back_button_pressed() -func _on_back_button_pressed(): +func _on_back_button_pressed() -> void: Events.Options.save_settings_to_file() back_button_pressed.emit() diff --git a/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd b/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd index 57ba4ab..4fb02a6 100644 --- a/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd +++ b/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd @@ -1,4 +1,4 @@ extends SettingOptionButton -func _setup_button(): +func _setup_button() -> void: pass diff --git a/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd b/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd index 31b115b..d66833e 100644 --- a/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd +++ b/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd @@ -1,5 +1,5 @@ extends SettingOptionButton -func _setup_button(): +func _setup_button() -> void: pass diff --git a/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd index cb7a1fb..1a21211 100644 --- a/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd +++ b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd @@ -34,7 +34,7 @@ func _sync_resolutions() -> void: selected = default_selected _update_resolution_options_text() -func _notification(what : int): +func _notification(what : int) -> void: match what: NOTIFICATION_TRANSLATION_CHANGED: _update_resolution_options_text() @@ -56,7 +56,7 @@ func _update_resolution_options_text() -> void: set_item_text(index, display_name) func _setup_button() -> void: - Resolution.resolution_added.connect(func (_value : Vector2i): _sync_resolutions()) + Resolution.resolution_added.connect(func (_value : Vector2i) -> void: _sync_resolutions()) if default_value.x <= 0: default_value.x = ProjectSettings.get_setting("display/window/size/viewport_width") if default_value.y <= 0: @@ -66,7 +66,7 @@ func _setup_button() -> void: else: _sync_resolutions() -func _get_value_for_file(select_value : int) -> Variant: +func _get_value_for_file(select_value : int): if _valid_index(select_value): return get_item_metadata(select_value) else: @@ -74,7 +74,7 @@ func _get_value_for_file(select_value : int) -> Variant: # REQUIREMENTS: # * SS-25 -func _set_value_from_file(load_value) -> void: +func _set_value_from_file(load_value : Variant) -> void: var target_resolution := Resolution.error_resolution match typeof(load_value): TYPE_VECTOR2I: target_resolution = load_value diff --git a/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd index 0d1836c..84ec9c9 100644 --- a/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd +++ b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd @@ -28,7 +28,7 @@ func get_window_mode_from_screen_mode(screen_mode : ScreenMode) -> Window.Mode: _: return Window.MODE_EXCLUSIVE_FULLSCREEN -func _setup_button(): +func _setup_button() -> void: default_selected = get_screen_mode_from_window_mode(Resolution.get_current_window_mode()) selected = default_selected diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingCheckBox.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingCheckBox.gd index 344a2b5..46fe4d7 100644 --- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingCheckBox.gd +++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingCheckBox.gd @@ -15,14 +15,14 @@ var default_pressed : bool = true func _setup_button() -> void: pass -func _ready(): +func _ready() -> void: Events.Options.load_settings.connect(load_setting) Events.Options.save_settings.connect(save_setting) Events.Options.reset_settings.connect(reset_setting) - toggled.connect(func(p : bool): option_selected.emit(p, true)) + toggled.connect(func(p : bool) -> void: option_selected.emit(p, true)) _setup_button() -func _set_value_from_file(load_value) -> void: +func _set_value_from_file(load_value : Variant) -> void: match typeof(load_value): TYPE_BOOL, TYPE_INT: set_pressed_no_signal(load_value as bool) diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd index 6fa30ed..a728ba0 100644 --- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd +++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd @@ -10,14 +10,14 @@ var setting_name : String = "setting_hslider" @export var default_value : float = 0 -func _ready(): +func _ready() -> void: Events.Options.load_settings.connect(load_setting) Events.Options.save_settings.connect(save_setting) Events.Options.reset_settings.connect(reset_setting) -func load_setting(file : ConfigFile): +func load_setting(file : ConfigFile) -> void: if file == null: return - var load_value = file.get_value(section_name, setting_name, default_value) + var load_value : Variant = file.get_value(section_name, setting_name, default_value) match typeof(load_value): TYPE_FLOAT, TYPE_INT: if value == load_value: value_changed.emit(value) @@ -33,9 +33,9 @@ func load_setting(file : ConfigFile): push_error("Setting value '%s' invalid for setting [%s] \"%s\"" % [load_value, section_name, setting_name]) value = default_value -func save_setting(file : ConfigFile): +func save_setting(file : ConfigFile) -> void: if file == null: return file.set_value(section_name, setting_name, value) -func reset_setting(): +func reset_setting() -> void: value = default_value diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd index 079dd4d..a972ed6 100644 --- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd +++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd @@ -21,13 +21,13 @@ var default_selected : int = -1: func _valid_index(index : int) -> bool: return 0 <= index and index < item_count -func _get_value_for_file(select_value : int): +func _get_value_for_file(select_value : int) -> Variant: if _valid_index(select_value): return select_value else: return null -func _set_value_from_file(load_value) -> void: +func _set_value_from_file(load_value : Variant) -> void: match typeof(load_value): TYPE_INT: if _valid_index(load_value): @@ -50,11 +50,11 @@ func _set_value_from_file(load_value) -> void: func _setup_button() -> void: pass -func _ready(): +func _ready() -> void: Events.Options.load_settings.connect(load_setting) Events.Options.save_settings.connect(save_setting) Events.Options.reset_settings.connect(reset_setting) - item_selected.connect(func(index : int): option_selected.emit(index, true)) + item_selected.connect(func(index : int) -> void: option_selected.emit(index, true)) _setup_button() if not _valid_index(default_selected) or selected == -1: var msg := "Failed to generate any valid %s %s options." % [setting_name, section_name] diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd index 431e3e5..6785f73 100644 --- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd +++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd @@ -6,7 +6,7 @@ class_name SettingRevertButton var previous_index : int = -1 -func _ready(): +func _ready() -> void: super() if revert_dialog != null: revert_dialog.visibility_changed.connect(_on_revert_dialog_visibility_changed) diff --git a/game/src/Game/Menu/OptionMenu/SettingRevertDialog.gd b/game/src/Game/Menu/OptionMenu/SettingRevertDialog.gd index 5e2b81f..7928d15 100644 --- a/game/src/Game/Menu/OptionMenu/SettingRevertDialog.gd +++ b/game/src/Game/Menu/OptionMenu/SettingRevertDialog.gd @@ -16,12 +16,12 @@ func show_dialog(button : SettingRevertButton, time : float = 0) -> void: popup_centered(Vector2(1,1)) _revert_node = button -func _notification(what): +func _notification(what : int) -> void: if what == NOTIFICATION_VISIBILITY_CHANGED: set_process(visible) if not visible: _revert_node = null -func _process(_delta) -> void: +func _process(_delta : float) -> void: dialog_text = tr(dialog_text_key).format({ "time": Localisation.tr_number(int(timer.time_left)) }) func _on_canceled_or_close_requested() -> void: diff --git a/game/src/Game/Menu/OptionMenu/SoundTab.gd b/game/src/Game/Menu/OptionMenu/SoundTab.gd index d1daf3d..a84af70 100644 --- a/game/src/Game/Menu/OptionMenu/SoundTab.gd +++ b/game/src/Game/Menu/OptionMenu/SoundTab.gd @@ -2,5 +2,5 @@ extends HBoxContainer @export var _startup_music_button : SettingCheckBox -func _ready(): - _startup_music_button.option_selected.connect(func (pressed : bool, _by_user : bool): MusicConductor.set_startup_music(pressed)) +func _ready() -> void: + _startup_music_button.option_selected.connect(func (pressed : bool, _by_user : bool) -> void: MusicConductor.set_startup_music(pressed)) diff --git a/game/src/Game/Menu/OptionMenu/VolumeGrid.gd b/game/src/Game/Menu/OptionMenu/VolumeGrid.gd index 46613b4..cce231f 100644 --- a/game/src/Game/Menu/OptionMenu/VolumeGrid.gd +++ b/game/src/Game/Menu/OptionMenu/VolumeGrid.gd @@ -39,7 +39,7 @@ func add_volume_row(bus_name : String, bus_index : int) -> HSlider: # REQUIREMENTS # * UI-22 -func _ready(): +func _ready() -> void: for bus_index in AudioServer.bus_count: add_volume_row(AudioServer.get_bus_name(bus_index), bus_index) @@ -54,17 +54,17 @@ func _on_slider_value_changed(value : float, bus_index : int) -> void: AudioServer.set_bus_volume_db(bus_index, get_volume_value_as_db(value)) -func _on_options_menu_load_settings(load_file : ConfigFile): - for volume_slider in _slider_dictionary.values(): +func _on_options_menu_load_settings(load_file : ConfigFile) -> void: + for volume_slider : SettingHSlider in _slider_dictionary.values(): volume_slider.load_setting(load_file) # REQUIREMENTS # * UIFUN-23 -func _on_options_menu_save_settings(save_file : ConfigFile): - for volume_slider in _slider_dictionary.values(): +func _on_options_menu_save_settings(save_file : ConfigFile) -> void: + for volume_slider : SettingHSlider in _slider_dictionary.values(): volume_slider.save_setting(save_file) -func _on_options_menu_reset_settings(): - for volume_slider in _slider_dictionary.values(): +func _on_options_menu_reset_settings() -> void: + for volume_slider : SettingHSlider in _slider_dictionary.values(): volume_slider.reset_setting() |