Files
puzzle-quest/scenes/UI/settings/Settings.gd
T
2021-05-25 14:14:03 +02:00

31 lines
1.1 KiB
GDScript

extends Node
func _ready():
print("[Settings#_ready]")
_translation()
_apply_settings_language()
_apply_settings_gyroscope()
_apply_settings_sound_ambiant()
## PRIVATE
func _translation():
$VBoxContainer/Langue/HBoxContainer/Label.text = tr("SETTINGS_LABEL_LANGUE")
$VBoxContainer/gyroscope/HBoxContainer/Label.text = tr("SETTINGS_LABEL_GYROSCOPE")
func _apply_settings_language():
$VBoxContainer/Langue/HBoxContainer/data.set_text(Global.get_setting_language())
func _apply_settings_gyroscope():
$VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(Global.get_setting_gyrosocpe())
func _apply_settings_sound_ambiant():
$VBoxContainer/ambiant_sound/HBoxContainer/data.set_pressed(Global.get_setting_ambiant_sound())
func _on_gyroscope_pressed():
print("[Settings#_on_gyroscope_pressed] change value to database ...........")
Global.set_setting_gyroscope(int($VBoxContainer/gyroscope/HBoxContainer/data.pressed))
func _on_ambiant_sound_pressed():
print("[Settings#_on_ambiant_sound_pressed] change value to database ...........")
Global.set_setting_ambiant_sound(int($VBoxContainer/ambiant_sound/HBoxContainer/data.pressed))