Files
puzzle-quest/db/MSetting.gd
T

71 lines
1.5 KiB
GDScript
Raw Normal View History

extends "res://db/MBase.gd"
2021-05-29 21:09:10 +02:00
var m_langue = null
var m_gyroscope = null
var m_ambient_sound = null
var m_resolution = null
var m_fullscreen = null
2021-06-06 19:11:21 +02:00
var m_version = null
2021-05-29 21:09:10 +02:00
const ROW_ID = 0
const LANGUE_ID = 0
const GYRSOCPE_ID = 1
const AMBIENT_SOUND = 2
const RESOLUTION = 3
const FULLSCREEN = 4
2021-06-06 19:11:21 +02:00
const VERSION = 5
func _init():
table = Global.database.get_table_by_name("settings")
2021-05-29 21:09:10 +02:00
var datas = table.get_data_at_row_idx(ROW_ID)
2021-05-29 21:09:10 +02:00
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)
2021-06-06 19:11:21 +02:00
m_version = _get_data(datas, VERSION)
func get_langue():
return int(m_langue)
func get_gyroscope():
return bool(int(m_gyroscope))
2021-05-23 21:33:44 +02:00
func get_ambient_sound():
return bool(int(m_ambient_sound))
2021-05-29 21:09:10 +02:00
func get_resolution():
return m_resolution.split(" x ")
func get_fullscreen():
return bool(int(m_fullscreen))
2021-06-06 19:11:21 +02:00
func get_version():
return "v" + str(m_version)
2021-06-06 19:11:21 +02:00
func set_langue(value):
2021-05-29 21:09:10 +02:00
m_langue = _set_data(LANGUE_ID, ROW_ID, value)
return get_langue()
func set_gyroscope(value):
2021-05-29 21:09:10 +02:00
m_gyroscope = _set_data(GYRSOCPE_ID, ROW_ID, value)
return get_gyroscope()
2021-05-23 21:33:44 +02:00
func set_ambient_sound(value):
2021-05-29 21:09:10 +02:00
m_ambient_sound = _set_data(AMBIENT_SOUND, ROW_ID, value)
2021-05-23 21:33:44 +02:00
return get_ambient_sound()
2021-05-29 21:09:10 +02:00
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()