Files
puzzle-quest/db/MSetting.gd
T

46 lines
1.1 KiB
GDScript
Raw Normal View History

extends "res://db/MBase.gd"
var m_langue = { "id": null, "value": null }
var m_gyroscope = { "id": null, "value": null }
2021-05-23 21:33:44 +02:00
var m_ambient_sound = { "id": null, "value": null }
const ROW = 0
func _init():
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)
2021-05-23 21:33:44 +02:00
m_ambient_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
2021-05-23 21:33:44 +02:00
func get_ambient_sound():
return int(m_ambient_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()
2021-05-23 21:33:44 +02:00
func set_ambient_sound(value):
m_ambient_sound["value"] = _set_data(value, m_ambient_sound["id"], gddb_types.e_prop_type_bool)
2021-05-23 21:33:44 +02:00
return get_ambient_sound()