feature/list-object-counter (#60)

Co-authored-by: VAILLANT Jeremy <vaillant.jeremy@dev-crea.com>
Reviewed-on: Athena/game-source#60
Co-authored-by: darknight <vaillant.jeremy@dev-crea.com>
Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
This commit is contained in:
darknight
2021-05-29 21:09:10 +02:00
parent 80890cbdce
commit ed20465f39
22 changed files with 475 additions and 165 deletions
+39 -20
View File
@@ -1,45 +1,64 @@
extends "res://db/MBase.gd"
var m_langue = { "id": null, "value": null }
var m_gyroscope = { "id": null, "value": null }
var m_ambient_sound = { "id": null, "value": null }
var m_langue = null
var m_gyroscope = null
var m_ambient_sound = null
var m_resolution = null
var m_fullscreen = null
const ROW = 0
const ROW_ID = 0
const LANGUE_ID = 0
const GYRSOCPE_ID = 1
const AMBIENT_SOUND = 2
const RESOLUTION = 3
const FULLSCREEN = 4
func _init():
table = Global.database.get_table_by_name("settings")
var datas = table.get_data_at_row_idx(ROW)
var datas = table.get_data_at_row_idx(ROW_ID)
m_langue = _get_data_info(datas, 0)
m_gyroscope = _get_data_info(datas, 1)
m_ambient_sound = _get_data_info(datas, 2)
func _get_data_info(datas, id):
return {
"id": id,
"value": _get_data(datas, id)
}
m_langue = _get_data(datas, LANGUE_ID)
m_gyroscope = _get_data(datas, GYRSOCPE_ID)
m_ambient_sound = _get_data(datas, AMBIENT_SOUND)
m_resolution = _get_data(datas, RESOLUTION)
m_fullscreen = _get_data(datas, FULLSCREEN)
func get_langue():
return m_langue["value"]
return m_langue as int
func get_gyroscope():
return int(m_gyroscope["value"]) as bool
return int(m_gyroscope) as bool
func get_ambient_sound():
return int(m_ambient_sound["value"]) as bool
return int(m_ambient_sound) as bool
func get_resolution():
return m_resolution.split(" x ")
func get_fullscreen():
return int(m_fullscreen) as bool
func set_langue(value):
m_langue["value"] = _set_data(value, m_langue["id"], gddb_types.e_prop_type_string)
m_langue = _set_data(LANGUE_ID, ROW_ID, value)
return get_langue()
func set_gyroscope(value):
m_gyroscope["value"] = _set_data(value, m_gyroscope["id"], gddb_types.e_prop_type_bool)
m_gyroscope = _set_data(GYRSOCPE_ID, ROW_ID, value)
return get_gyroscope()
func set_ambient_sound(value):
m_ambient_sound["value"] = _set_data(value, m_ambient_sound["id"], gddb_types.e_prop_type_bool)
m_ambient_sound = _set_data(AMBIENT_SOUND, ROW_ID, value)
return get_ambient_sound()
func set_resolution(value):
m_resolution = _set_data(RESOLUTION, ROW_ID, value)
return get_resolution()
func set_fullscreen(value):
m_fullscreen = _set_data(FULLSCREEN, ROW_ID, value)
return get_fullscreen()