2021-05-13 20:01:51 +02:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
|
|
onready var language_id = null
|
|
|
|
|
onready var gyroscope_id = null
|
|
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
|
print("[Settings#_ready]")
|
|
|
|
|
_translation()
|
|
|
|
|
_apply_settings()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## PRIVATE
|
|
|
|
|
func _translation():
|
|
|
|
|
print("[Settings#_translation]")
|
2021-05-14 22:27:40 +02:00
|
|
|
$VBoxContainer/Langue/HBoxContainer/Label.text = tr("SETTINGS_LABEL_LANGUE")
|
|
|
|
|
$VBoxContainer/gyroscope/HBoxContainer/Label.text = tr("SETTINGS_LABEL_GYROSCOPE")
|
2021-05-13 20:01:51 +02:00
|
|
|
|
|
|
|
|
func _apply_settings():
|
|
|
|
|
print("[Settings#_apply_settings]")
|
|
|
|
|
var lang = _get_settings_data("langue", Global.table_settings, Global.data_settings)
|
|
|
|
|
var gyro = _get_settings_data("gyroscope", Global.table_settings, Global.data_settings)
|
|
|
|
|
|
2021-05-15 00:35:15 +02:00
|
|
|
#$CenterContainer/VBoxContainer/Langue/HBoxContainer/data.set_text(lang)
|
|
|
|
|
#$CenterContainer/VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(int(gyro) as bool)
|
2021-05-13 20:01:51 +02:00
|
|
|
|
|
|
|
|
func _get_settings_data(name, table, datas):
|
|
|
|
|
for index in range(0, Global.table_settings.get_props_count()):
|
|
|
|
|
if table.get_prop_at(index).get_prop_name() == name:
|
|
|
|
|
_save_id(name, table.get_prop_at(index).get_prop_id())
|
|
|
|
|
return datas[index].get_data()
|
|
|
|
|
|
|
|
|
|
func _save_id(name, id):
|
|
|
|
|
if name == "langue":
|
|
|
|
|
language_id = id
|
|
|
|
|
if name == "gyroscope":
|
|
|
|
|
gyroscope_id = id
|
|
|
|
|
|
|
|
|
|
func _on_gyroscope_pressed():
|
|
|
|
|
print("[Settings#_on_gyroscop_toggled] change value to database ...........")
|
|
|
|
|
Global.table_settings.edit_data(gyroscope_id,
|
|
|
|
|
gddb_types.e_prop_type_bool,
|
|
|
|
|
int($CenterContainer/VBoxContainer/gyroscope/HBoxContainer/data.pressed) as String)
|
|
|
|
|
Global.database.save_db()
|