2021-05-13 20:01:51 +02:00
|
|
|
extends Node
|
|
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _ready() -> void:
|
2021-05-29 21:09:10 +02:00
|
|
|
_apply_translation()
|
2021-05-23 21:21:10 +02:00
|
|
|
_apply_settings_language()
|
|
|
|
|
_apply_settings_gyroscope()
|
2021-05-23 21:33:44 +02:00
|
|
|
_apply_settings_sound_ambient()
|
2021-05-29 21:09:10 +02:00
|
|
|
_apply_settings_resolution()
|
|
|
|
|
_apply_settings_fullscreen()
|
2021-05-13 20:01:51 +02:00
|
|
|
|
|
|
|
|
## PRIVATE
|
2026-05-16 21:58:11 +02:00
|
|
|
func _apply_translation() -> void:
|
2021-05-29 21:09:10 +02:00
|
|
|
$VBoxContainer/langue/VBoxContainer/Label.text = tr("SETTINGS_LABEL_LANGUE")
|
2021-05-14 22:27:40 +02:00
|
|
|
$VBoxContainer/gyroscope/HBoxContainer/Label.text = tr("SETTINGS_LABEL_GYROSCOPE")
|
2021-05-13 20:01:51 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _apply_settings_language() -> void:
|
|
|
|
|
var data: ItemList = $VBoxContainer/langue/VBoxContainer/data
|
2021-05-29 21:09:10 +02:00
|
|
|
data.add_item("English", load("res://assets/ui/flags/english.png"), true) # id : 0
|
|
|
|
|
data.add_item("Français", load("res://assets/ui/flags/french.png"), true) # id : 1
|
2021-06-03 22:18:50 +02:00
|
|
|
data.select(Setting.get_setting_language())
|
2021-05-13 20:01:51 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _apply_settings_gyroscope() -> void:
|
2026-05-16 19:40:03 +02:00
|
|
|
$VBoxContainer/gyroscope/HBoxContainer/data.button_pressed = Setting.get_setting_gyrosocpe()
|
2021-05-13 20:01:51 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _apply_settings_sound_ambient() -> void:
|
2026-05-16 19:40:03 +02:00
|
|
|
$VBoxContainer/ambient_sound/HBoxContainer/data.button_pressed = Setting.get_setting_ambient_sound()
|
2021-05-13 20:01:51 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _apply_settings_resolution() -> void:
|
|
|
|
|
var data: ItemList = $VBoxContainer/resolution/VBoxContainer/data
|
|
|
|
|
data.add_item("2560 x 1440", null, true)
|
|
|
|
|
data.add_item("1920 x 1080", null, true)
|
|
|
|
|
data.add_item("1280 x 720", null, true)
|
|
|
|
|
data.add_item("854 x 576", null, true)
|
2021-05-29 21:09:10 +02:00
|
|
|
for index in range(4):
|
2026-05-16 21:58:11 +02:00
|
|
|
if data.get_item_text(index).split(" x ") == Setting.get_setting_resolution():
|
2021-05-29 21:09:10 +02:00
|
|
|
data.select(index)
|
|
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _apply_settings_fullscreen() -> void:
|
2026-05-16 19:40:03 +02:00
|
|
|
$VBoxContainer/fullscreen/HBoxContainer/data.button_pressed = Setting.get_setting_fullscreen()
|
2021-05-29 21:09:10 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _on_gyroscope_pressed() -> void:
|
|
|
|
|
Setting.set_setting_gyroscope($VBoxContainer/gyroscope/HBoxContainer/data.button_pressed)
|
2021-05-23 21:21:10 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _on_ambient_sound_pressed() -> void:
|
|
|
|
|
Setting.set_setting_ambient_sound($VBoxContainer/ambient_sound/HBoxContainer/data.button_pressed)
|
2021-05-29 21:09:10 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _on_langue_item_selected(index: int) -> void:
|
2021-06-03 22:18:50 +02:00
|
|
|
Setting.set_setting_language(index)
|
2021-05-29 21:09:10 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _on_resolution_item_selected(index: int) -> void:
|
2021-06-03 22:18:50 +02:00
|
|
|
Setting.set_setting_resolution($VBoxContainer/resolution/VBoxContainer/data.get_item_text(index))
|
2021-05-29 21:09:10 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _on_fullscreen_item_selected() -> void:
|
|
|
|
|
Setting.set_setting_fullscreen($VBoxContainer/fullscreen/HBoxContainer/data.button_pressed)
|