Add setting true/false audio background in war level

This commit is contained in:
VAILLANT Jeremy
2021-05-23 21:21:10 +02:00
parent d2c6aef9c5
commit c46cb1f41e
11 changed files with 189 additions and 91 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
extends Object
extends Node
var table = null
+48
View File
@@ -0,0 +1,48 @@
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()
+4 -3
View File
@@ -6,9 +6,10 @@
"table_name":"settings",
"props":[
{"name":"langue","type":"3","auto_increment":"0"},
{"name":"gyroscope","type":"0","auto_increment":"0"}
{"name":"gyroscope","type":"0","auto_increment":"0"},
{"name":"ambiant_sound","type":"0","auto_increment":"0"}
],
"data":["fr","0"]
"data":["fr","0","0"]
},
{
"table_name":"levels",
@@ -30,7 +31,7 @@
{"name":"mesh","type":"3","auto_increment":"0"},
{"name":"label_id","type":"1","auto_increment":"0"}
],
"data":["0.0","True","Dagger","0","dagger","0","dagger","0","0.0","0","Fiole","0","fiole1","0","fioles/fiole1","1","0.0","0","Fiole","0","fiole2","0","fioles/fiole2","1","0.0","0","Fiole","0","fiole3","0","fioles/fiole_socle/fiole3","1","0.0","0","Spyglass","0","spyglass","0","spyglass","2","0.0","0","Coins","0","coin1","0","golds/coin1","3","0.0","0","Coins","0","coin2","0","golds/coin2","3","0.0","0","Coins","0","coin3","0","golds/coin3","3","0.0","0","Weapon Gun","0","weapon","0","weapon","4","0.0","0","Apple","0","apple1","0","apples/apple1","5","0.0","0","Apple","0","apple2","0","apples/apple2","5","0.0","0","Apple","0","apple3","0","apples/apple3","5","0.0","0","Apple","0","apple4","0","apples/apple4","5","0.0","0","Beer","0","beer","0","beer","6","0.0","0","SuperDagger","0","gadder","1","sm_super_dager","0"]
"data":["0.0","True","Dagger","0","dagger","0","dagger","0","0.0","0","Fiole","197246","fiole1","0","fioles/fiole1","1","0.97","0","Fiole","0","fiole2","0","fioles/fiole2","1","0.0","0","Fiole","0","fiole3","0","fioles/fiole_socle/fiole3","1","0.0","0","Spyglass","0","spyglass","0","spyglass","2","0.0","0","Coins","0","coin1","0","golds/coin1","3","0.0","0","Coins","0","coin2","0","golds/coin2","3","0.0","0","Coins","0","coin3","0","golds/coin3","3","0.0","0","Weapon Gun","0","weapon","0","weapon","4","0.0","0","Apple","0","apple1","0","apples/apple1","5","0.0","0","Apple","0","apple2","0","apples/apple2","5","0.0","0","Apple","0","apple3","0","apples/apple3","5","0.0","0","Apple","0","apple4","0","apples/apple4","5","0.0","0","Beer","0","beer","0","beer","6","0.0","0","SuperDagger","0","gadder","1","sm_super_dager","0"]
}
]
}