49 lines
1.3 KiB
GDScript
49 lines
1.3 KiB
GDScript
extends "res://db/MBase.gd"
|
|
|
|
var m_langue = { "id": null, "value": null }
|
|
var m_gyroscope = { "id": null, "value": null }
|
|
var m_ambiant_sound = { "id": null, "value": null }
|
|
|
|
const ROW = 0
|
|
|
|
func _init():
|
|
print("[MSetting#_ready]")
|
|
table = Global.database.get_table_by_name("settings")
|
|
var datas = table.get_data_at_row_idx(ROW)
|
|
|
|
m_langue = _get_data_info(datas, 0)
|
|
m_gyroscope = _get_data_info(datas, 1)
|
|
m_ambiant_sound = _get_data_info(datas, 2)
|
|
|
|
func _get_data_info(datas, id):
|
|
return {
|
|
"id": id,
|
|
"value": _get_data(datas, id)
|
|
}
|
|
|
|
func get_langue():
|
|
return m_langue["value"]
|
|
|
|
func get_gyroscope():
|
|
return int(m_gyroscope["value"]) as bool
|
|
|
|
func get_ambiant_sound():
|
|
print("[msetting#get_ambiant_sound] "+String(m_ambiant_sound))
|
|
return int(m_ambiant_sound["value"]) as bool
|
|
|
|
func set_langue(value):
|
|
m_langue["value"] = _set_data(value, m_langue["id"], gddb_types.e_prop_type_string)
|
|
|
|
return get_langue()
|
|
|
|
func set_gyroscope(value):
|
|
m_gyroscope["value"] = _set_data(value, m_gyroscope["id"], gddb_types.e_prop_type_bool)
|
|
|
|
return get_gyroscope()
|
|
|
|
func set_ambiant_sound(value):
|
|
print("[msetting#get_ambiant_sound] save new value of mabiant sound")
|
|
m_ambiant_sound["value"] = _set_data(value, m_ambiant_sound["id"], gddb_types.e_prop_type_bool)
|
|
|
|
return get_ambiant_sound()
|