Reordering scene, and setup basic scene instance on main view

This commit is contained in:
stilobique-surface
2021-05-14 22:27:40 +02:00
committed by Vaillant Jeremy
parent fa4ec8baea
commit 74a5c3ac69
17 changed files with 238 additions and 368 deletions
+43
View File
@@ -0,0 +1,43 @@
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]")
$VBoxContainer/Langue/HBoxContainer/Label.text = tr("SETTINGS_LABEL_LANGUE")
$VBoxContainer/gyroscope/HBoxContainer/Label.text = tr("SETTINGS_LABEL_GYROSCOPE")
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)
$CenterContainer/VBoxContainer/Langue/HBoxContainer/data.set_text(lang)
$CenterContainer/VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(int(gyro) as bool)
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()
+64
View File
@@ -0,0 +1,64 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/UI/settings/Settings.gd" type="Script" id=1]
[node name="Settings" type="CenterContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 643.0
margin_top = 421.0
margin_right = 796.0
margin_bottom = 479.0
alignment = 1
[node name="Langue" type="CenterContainer" parent="VBoxContainer"]
margin_right = 153.0
margin_bottom = 14.0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Langue"]
margin_left = 42.0
margin_right = 111.0
margin_bottom = 14.0
[node name="Label" type="Label" parent="VBoxContainer/Langue/HBoxContainer"]
margin_right = 50.0
margin_bottom = 14.0
text = "langue :"
[node name="data" type="Label" parent="VBoxContainer/Langue/HBoxContainer"]
margin_left = 54.0
margin_right = 69.0
margin_bottom = 14.0
text = "FR"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="gyroscope" type="CenterContainer" parent="VBoxContainer"]
margin_top = 18.0
margin_right = 153.0
margin_bottom = 58.0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/gyroscope"]
margin_right = 153.0
margin_bottom = 40.0
[node name="Label" type="Label" parent="VBoxContainer/gyroscope/HBoxContainer"]
margin_top = 13.0
margin_right = 73.0
margin_bottom = 27.0
text = "gyroscope :"
[node name="data" type="CheckButton" parent="VBoxContainer/gyroscope/HBoxContainer"]
margin_left = 77.0
margin_right = 153.0
margin_bottom = 40.0
align = 1
[connection signal="pressed" from="VBoxContainer/gyroscope/HBoxContainer/data" to="." method="_on_gyroscope_pressed"]