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:
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/victory.ogg-f200c5ed87d76f20ec981fde28a9e56b.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sounds/victory.ogg"
|
||||
dest_files=[ "res://.import/victory.ogg-f200c5ed87d76f20ec981fde28a9e56b.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/english.png-20d96f7f394d3ab1f4e22fda2b102e91.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/ui/flags/english.png"
|
||||
dest_files=[ "res://.import/english.png-20d96f7f394d3ab1f4e22fda2b102e91.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/french.png-5cfa6908ad0af9f9e25b03e8896a0724.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/ui/flags/french.png"
|
||||
dest_files=[ "res://.import/french.png-5cfa6908ad0af9f9e25b03e8896a0724.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
+3
-9
@@ -5,13 +5,7 @@ var table = null
|
||||
func _get_data(datas, index):
|
||||
return datas[index].get_data()
|
||||
|
||||
func _set_data(value, id, type):
|
||||
table.edit_data(id, type, String(value))
|
||||
func _set_data(prop_id, row_id, data):
|
||||
table.edit_data(prop_id, row_id, String(data))
|
||||
Global.database.save_db()
|
||||
return value
|
||||
|
||||
func _get_data_id(prop_name, index):
|
||||
if table.get_prop_at(index).get_prop_name() == prop_name:
|
||||
return table.get_prop_at(index).get_prop_id()
|
||||
else:
|
||||
return null
|
||||
return data
|
||||
|
||||
+13
-4
@@ -3,13 +3,13 @@ extends "res://db/MBase.gd"
|
||||
var m_name = null
|
||||
var m_thumb = null
|
||||
var m_level = null
|
||||
var mscene = load("res://db/MScene.gd")
|
||||
|
||||
func _init(row_idx):
|
||||
m_level = row_idx
|
||||
table = Global.database.get_table_by_name("levels")
|
||||
|
||||
var datas = table.get_data_at_row_idx(m_level)
|
||||
if true:
|
||||
m_name = _get_name(datas)
|
||||
m_thumb = _get_thumb(datas)
|
||||
|
||||
@@ -22,15 +22,24 @@ func object_to_find():
|
||||
|
||||
return count as String
|
||||
|
||||
func reset():
|
||||
var scene_detail = null
|
||||
var t = Global.database.get_table_by_name("scenes")
|
||||
|
||||
for row_index in range(0, t.m_rows_count):
|
||||
scene_detail = mscene.new(row_index)
|
||||
if scene_detail.label() != null:
|
||||
scene_detail.set_lock(int(false))
|
||||
|
||||
func _scenes():
|
||||
return Global.database.get_table_by_name("scenes")
|
||||
|
||||
func object_finding():
|
||||
var count = 0
|
||||
var datas = _scenes().get_data_by_prop_name_and_data("lock", String(m_level))
|
||||
|
||||
if datas.size() != 0:
|
||||
count = datas.count(true)
|
||||
for datas in _scenes().get_dictionary_by_prop_name_and_data("level", String(m_level)):
|
||||
if int(datas['lock']) == 1:
|
||||
count = count + 1
|
||||
|
||||
return count as String
|
||||
|
||||
|
||||
+41
-52
@@ -1,38 +1,36 @@
|
||||
extends "res://db/MBase.gd"
|
||||
|
||||
var m_value = { "id": null, "value": null }
|
||||
var m_lock = { "id": null, "value": null }
|
||||
var m_value = 0
|
||||
var m_lock = null
|
||||
var m_label = null
|
||||
var m_label_id = null
|
||||
var m_tick_reference = { "id": null, "value": null }
|
||||
var m_label_counter = null
|
||||
var m_tick_reference = 0
|
||||
var m_key = null
|
||||
var m_level = null
|
||||
var m_mesh = null
|
||||
var m_counter = null
|
||||
var m_row_id = null
|
||||
|
||||
const LOCK_ID = 0
|
||||
const LABEL_ID = 1
|
||||
const KEY_ID = 2
|
||||
const LEVEL_ID = 3
|
||||
const MESH_ID = 4
|
||||
const LABEL_COUNTER = 5
|
||||
const COUNTER_ID = 6
|
||||
|
||||
func _init(row_index):
|
||||
table = Global.database.get_table_by_name("scenes")
|
||||
m_row_id = row_index
|
||||
var datas = table.get_data_at_row_idx(m_row_id)
|
||||
|
||||
var datas = table.get_data_at_row_idx(row_index)
|
||||
if _get_level(datas) == Global.current_scene_int:
|
||||
m_key = _get_key(datas)
|
||||
m_value["value"] = _get_value(datas)
|
||||
m_lock["value"] = _get_lock(datas)
|
||||
m_lock = _get_lock(datas)
|
||||
m_label = _get_label(datas)
|
||||
m_label_id = _get_label_id(datas)
|
||||
m_tick_reference["value"] = _get_tick_reference(datas)
|
||||
m_label_counter = _get_label_counter(datas)
|
||||
m_mesh = _get_mesh(datas)
|
||||
|
||||
func search_keys():
|
||||
for prop_index in range(0, table.get_props_count()):
|
||||
if table.get_prop_at(prop_index).get_prop_name() == "value" or \
|
||||
table.get_prop_at(prop_index).get_prop_name() == "lock" or \
|
||||
table.get_prop_at(prop_index).get_prop_name() == "tick_reference":
|
||||
if m_value["id"] == null:
|
||||
m_value["id"] = _get_value_id(prop_index)
|
||||
if m_lock["id"] == null:
|
||||
m_lock["id"] = _get_lock_id(prop_index)
|
||||
if m_tick_reference["id"] == null:
|
||||
m_tick_reference["id"] = _get_tick_reference_id(prop_index)
|
||||
m_counter = _get_counter(datas)
|
||||
|
||||
func key():
|
||||
return m_key
|
||||
@@ -40,14 +38,14 @@ func key():
|
||||
func label():
|
||||
return m_label
|
||||
|
||||
func label_id():
|
||||
return m_label_id
|
||||
func label_counter():
|
||||
return m_label_counter
|
||||
|
||||
func lock():
|
||||
return m_lock["value"]
|
||||
return m_lock
|
||||
|
||||
func set_lock(value):
|
||||
m_lock["value"] = _set_data(value, m_lock["id"], gddb_types.e_prop_type_bool)
|
||||
m_lock = _set_data(LOCK_ID, m_row_id, value)
|
||||
|
||||
func mesh():
|
||||
return m_mesh
|
||||
@@ -56,52 +54,43 @@ func set_mesh(value):
|
||||
m_mesh = value
|
||||
|
||||
func tick_reference():
|
||||
return m_tick_reference["value"]
|
||||
return m_tick_reference
|
||||
|
||||
func set_tick_reference(value):
|
||||
m_tick_reference["value"] = _set_data(value, m_tick_reference["id"], gddb_types.e_prop_type_int)
|
||||
m_tick_reference = value
|
||||
|
||||
func value():
|
||||
return m_value["value"]
|
||||
return m_value
|
||||
|
||||
func set_value(value):
|
||||
m_value["value"] = _set_data(value, m_value["id"], gddb_types.e_prop_type_float)
|
||||
m_value = value
|
||||
|
||||
func audio_sound():
|
||||
var stream = load("res://assets/sounds/objects/" + label() + ".ogg")
|
||||
stream.set_loop(false)
|
||||
return stream
|
||||
|
||||
func counter():
|
||||
return m_counter
|
||||
|
||||
## PRIVATE
|
||||
func _get_value(datas):
|
||||
return _get_data(datas, 0) as float
|
||||
|
||||
func _get_value_id(index):
|
||||
return _get_data_id("value", index)
|
||||
|
||||
func _get_lock(datas):
|
||||
return int(_get_data(datas, 1)) as bool
|
||||
|
||||
func _get_lock_id(index):
|
||||
return _get_data_id("lock", index)
|
||||
return int(_get_data(datas, LOCK_ID)) as bool
|
||||
|
||||
func _get_label(datas):
|
||||
return _get_data(datas, 2) as String
|
||||
|
||||
func _get_label_id(datas):
|
||||
return _get_data(datas, 7) as String
|
||||
|
||||
func _get_tick_reference(datas):
|
||||
return _get_data(datas, 3) as int
|
||||
|
||||
func _get_tick_reference_id(index):
|
||||
return _get_data_id("tick_reference", index)
|
||||
return _get_data(datas, LABEL_ID) as String
|
||||
|
||||
func _get_key(datas):
|
||||
return _get_data(datas, 4) as String
|
||||
return _get_data(datas, KEY_ID) as String
|
||||
|
||||
func _get_level(datas):
|
||||
return _get_data(datas, 5) as int
|
||||
return _get_data(datas, LEVEL_ID) as int
|
||||
|
||||
func _get_mesh(datas):
|
||||
return "Hidden Objects Items/" + String(_get_data(datas, 6))
|
||||
return "Hidden Objects Items/" + String(_get_data(datas, MESH_ID))
|
||||
|
||||
func _get_label_counter(datas):
|
||||
return _get_data(datas, LABEL_COUNTER) as String
|
||||
|
||||
func _get_counter(datas):
|
||||
return _get_data(datas, COUNTER_ID) as int
|
||||
|
||||
+39
-20
@@ -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()
|
||||
|
||||
+8
-7
@@ -5,11 +5,13 @@
|
||||
{
|
||||
"table_name":"settings",
|
||||
"props":[
|
||||
{"name":"langue","type":"3","auto_increment":"0"},
|
||||
{"name":"langue","type":"1","auto_increment":"0"},
|
||||
{"name":"gyroscope","type":"0","auto_increment":"0"},
|
||||
{"name":"ambiant_sound","type":"0","auto_increment":"0"}
|
||||
{"name":"ambiant_sound","type":"0","auto_increment":"0"},
|
||||
{"name":"resolution","type":"3","auto_increment":"0"},
|
||||
{"name":"fullscreen","type":"0","auto_increment":"0"}
|
||||
],
|
||||
"data":["fr","0","0"]
|
||||
"data":["fr","0","0","1920 x 1080","0"]
|
||||
},
|
||||
{
|
||||
"table_name":"levels",
|
||||
@@ -22,16 +24,15 @@
|
||||
{
|
||||
"table_name":"scenes",
|
||||
"props":[
|
||||
{"name":"value","type":"2","auto_increment":"0"},
|
||||
{"name":"lock","type":"0","auto_increment":"0"},
|
||||
{"name":"label","type":"3","auto_increment":"0"},
|
||||
{"name":"tick_reference","type":"1","auto_increment":"0"},
|
||||
{"name":"key","type":"3","auto_increment":"0"},
|
||||
{"name":"level","type":"table","table_name":"levels","auto_increment":"0"},
|
||||
{"name":"mesh","type":"3","auto_increment":"0"},
|
||||
{"name":"label_id","type":"1","auto_increment":"0"}
|
||||
{"name":"label_counter","type":"1","auto_increment":"0"},
|
||||
{"name":"counter","type":"1","auto_increment":"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"]
|
||||
"data":["1","Dagger","dagger","0","dagger","1","1","1","Fiole","fiole1","0","fioles/fiole1","1","3","0","Fiole","fiole2","0","fioles/fiole2","1","3","0","Fiole","fiole3","0","fioles/fiole_socle/fiole3","1","3","1","Spyglass","spyglass","0","spyglass","2","1","1","Coins","coin1","0","golds/coin1","3","3","0","Coins","coin2","0","golds/coin2","3","3","0","Coins","coin3","0","golds/coin3","3","3","0","Weapon Gun","weapon","0","weapon","4","1","0","Apple","apple1","0","apples/apple1","5","4","0","Apple","apple2","0","apples/apple2","5","4","0","Apple","apple3","0","apples/apple3","5","4","1","Apple","apple4","0","apples/apple4","5","4","0","Beer","beer","0","beer","6","1","0","SuperDagger","gadder","1","sm_super_dager","0","1"]
|
||||
}
|
||||
]
|
||||
}
|
||||
+1
-1
@@ -253,7 +253,7 @@ ui_end={
|
||||
[locale]
|
||||
|
||||
translations=PoolStringArray( "res://locales/fr.po", "res://locales/en.po" )
|
||||
locale_filter=[ 0, [ "en_US", "fr_FR" ] ]
|
||||
locale_filter=[ 1, [ "en_GB", "fr_FR" ] ]
|
||||
|
||||
[physics]
|
||||
|
||||
|
||||
+42
-3
@@ -13,17 +13,41 @@ var msetting = preload("res://db/MSetting.gd")
|
||||
var setting = null
|
||||
|
||||
func _ready():
|
||||
print("[global#_ready]")
|
||||
_initialize_database()
|
||||
_initialize_setting()
|
||||
_initialize_current_scene()
|
||||
|
||||
func _initialize_setting():
|
||||
print("global#_initialize_setting")
|
||||
setting = msetting.new()
|
||||
|
||||
apply_language(translate_int_to_locale(get_setting_language()))
|
||||
apply_resolution()
|
||||
apply_fullscreen()
|
||||
|
||||
func translate_int_to_locale(id):
|
||||
var lang = "en_GB"
|
||||
|
||||
if id == 0:
|
||||
lang = "en_GB"
|
||||
|
||||
if id == 1:
|
||||
lang = "fr_FR"
|
||||
|
||||
return lang
|
||||
|
||||
func apply_language(local):
|
||||
TranslationServer.set_locale(local)
|
||||
|
||||
func apply_resolution():
|
||||
var screen_size = Vector2(get_setting_resolution()[0], get_setting_resolution()[1])
|
||||
var margin_size = Vector2(0, 0)
|
||||
get_viewport().set_size_override(true, screen_size, margin_size)
|
||||
|
||||
func apply_fullscreen():
|
||||
OS.set_window_fullscreen(get_setting_fullscreen())
|
||||
|
||||
func goto_scene(path):
|
||||
print("[global#goto_scene]")
|
||||
print("[global#goto_scene] : "+String(path))
|
||||
loader = ResourceLoader.load_interactive(path)
|
||||
if loader == null:
|
||||
print("Error loading ....")
|
||||
@@ -39,6 +63,7 @@ func get_setting_language():
|
||||
|
||||
func set_setting_language(value):
|
||||
setting.set_langue(value)
|
||||
apply_language(translate_int_to_locale(value))
|
||||
|
||||
func get_setting_gyrosocpe():
|
||||
return setting.get_gyroscope()
|
||||
@@ -52,6 +77,20 @@ func get_setting_ambient_sound():
|
||||
func set_setting_ambient_sound(value):
|
||||
setting.set_ambient_sound(value)
|
||||
|
||||
func get_setting_resolution():
|
||||
return setting.get_resolution()
|
||||
|
||||
func set_setting_resolution(value):
|
||||
setting.set_resolution(value)
|
||||
apply_resolution()
|
||||
|
||||
func get_setting_fullscreen():
|
||||
return setting.get_fullscreen()
|
||||
|
||||
func set_setting_fullscreen(value):
|
||||
setting.set_fullscreen(value)
|
||||
apply_fullscreen()
|
||||
|
||||
func _process(_delta):
|
||||
print("[global#_process]")
|
||||
if loader == null:
|
||||
|
||||
@@ -2,9 +2,7 @@ extends Control
|
||||
|
||||
export (PackedScene) var template = load("res://scenes/levels/Template.tscn")
|
||||
|
||||
onready var levels = Array()
|
||||
onready var mlevel = load("res://db/MLevel.gd")
|
||||
onready var table = Global.table_levels
|
||||
|
||||
func _ready():
|
||||
_apply_scenes()
|
||||
@@ -14,13 +12,17 @@ func _on_warcraft_pressed():
|
||||
Global.current_scene_int = 0
|
||||
Global.goto_scene("res://scenes/levels/warcraft/WarCraft.tscn")
|
||||
|
||||
func _on_reset_level():
|
||||
print("Reset level ...")
|
||||
func _on_reset_level(level, node, index):
|
||||
Global.current_scene_int = index
|
||||
level.reset()
|
||||
_configure_reset(level, node, index)
|
||||
_configure_counter(level, node)
|
||||
Global.current_scene_int = null
|
||||
|
||||
## PRIVATE
|
||||
func _apply_scenes():
|
||||
for row_index in range(0, Global.table_levels.m_rows_count):
|
||||
_apply_scene(mlevel.new(row_index))
|
||||
_apply_scene(mlevel.new(row_index), 0)
|
||||
|
||||
func _build_path(name):
|
||||
return "MarginContainer/HBoxContainer/"+name
|
||||
@@ -37,12 +39,12 @@ func _load_scene(name):
|
||||
func _load_texture(thumbnail):
|
||||
return load(thumbnail)
|
||||
|
||||
func _apply_scene(level):
|
||||
func _apply_scene(level, index):
|
||||
$MarginContainer/HBoxContainer.add_child(_load_scene(level.name()))
|
||||
var node = _build_path(level.name())
|
||||
|
||||
_configure_select(level, node)
|
||||
_configure_reset(level, node)
|
||||
_configure_reset(level, node, index)
|
||||
_configure_counter(level, node)
|
||||
|
||||
func _configure_select(level, node):
|
||||
@@ -51,12 +53,15 @@ func _configure_select(level, node):
|
||||
select.set_normal_texture(_load_texture(level.thumbnail()))
|
||||
select.connect("pressed", self, _build_method(level.name()))
|
||||
|
||||
func _configure_reset(level, node):
|
||||
func _configure_reset(level, node, index):
|
||||
var reset = get_node(node+"/VBoxContainer/MarginContainer/ButtonReset")
|
||||
|
||||
if int(level.object_finding()) != 0:
|
||||
if int(level.object_finding()) == 0:
|
||||
reset.set_disabled(true)
|
||||
reset.connect("pressed", self, "_on_reset_level")
|
||||
reset.disconnect("pressed", self, "_on_reset_level")
|
||||
else:
|
||||
reset.set_disabled(false)
|
||||
reset.connect("pressed", self, "_on_reset_level", [level, node, index])
|
||||
|
||||
func _configure_counter(level, node):
|
||||
var count = get_node(node+"/VBoxContainer/MarginContainer2/ButtonCount/Label")
|
||||
|
||||
@@ -16,10 +16,10 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
margin_left = 705.0
|
||||
margin_top = 435.0
|
||||
margin_right = 735.0
|
||||
margin_bottom = 465.0
|
||||
margin_left = 625.0
|
||||
margin_top = 345.0
|
||||
margin_right = 655.0
|
||||
margin_bottom = 375.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/margin_right = 15
|
||||
@@ -44,4 +44,7 @@ visible = false
|
||||
margin_right = 200.0
|
||||
margin_bottom = 284.0
|
||||
|
||||
[node name="ButtonReset" parent="MarginContainer/HBoxContainer/example/VBoxContainer/MarginContainer" index="0"]
|
||||
enabled_focus_mode = 0
|
||||
|
||||
[editable path="MarginContainer/HBoxContainer/example"]
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
extends CenterContainer
|
||||
|
||||
func _ready():
|
||||
print("[ending_#ready]")
|
||||
$AudioStreamPlayer.play()
|
||||
|
||||
func _on_Timer_timeout():
|
||||
print("[ending#_on_Timer_timeout]")
|
||||
Global.goto_scene("res://scenes/main.tscn")
|
||||
@@ -0,0 +1,63 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/UI/ending.gd" type="Script" id=1]
|
||||
[ext_resource path="res://assets/sounds/victory.ogg" type="AudioStream" id=2]
|
||||
[ext_resource path="res://assets/fonts/MKX Title.ttf" type="DynamicFontData" id=3]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 35
|
||||
font_data = ExtResource( 3 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
margin_left = 640.0
|
||||
margin_top = 360.0
|
||||
margin_right = 640.0
|
||||
margin_bottom = 360.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ColorRect"]
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 360.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="ColorRect/VBoxContainer"]
|
||||
margin_top = 95.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 264.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
text = "aHog !!!
|
||||
|
||||
|
||||
bravo vous avez gagné."
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 4.31
|
||||
autostart = true
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 2 )
|
||||
volume_db = -29.411
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
@@ -1,19 +1,25 @@
|
||||
extends Node
|
||||
|
||||
func _ready():
|
||||
print("[Settings#_ready]")
|
||||
_translation()
|
||||
_apply_translation()
|
||||
_apply_settings_language()
|
||||
_apply_settings_gyroscope()
|
||||
_apply_settings_sound_ambient()
|
||||
_apply_settings_resolution()
|
||||
_apply_settings_fullscreen()
|
||||
|
||||
## PRIVATE
|
||||
func _translation():
|
||||
$VBoxContainer/Langue/HBoxContainer/Label.text = tr("SETTINGS_LABEL_LANGUE")
|
||||
func _apply_translation():
|
||||
$VBoxContainer/langue/VBoxContainer/Label.text = tr("SETTINGS_LABEL_LANGUE")
|
||||
$VBoxContainer/gyroscope/HBoxContainer/Label.text = tr("SETTINGS_LABEL_GYROSCOPE")
|
||||
|
||||
func _apply_settings_language():
|
||||
$VBoxContainer/Langue/HBoxContainer/data.set_text(Global.get_setting_language())
|
||||
var data = $VBoxContainer/langue/VBoxContainer/data
|
||||
|
||||
data.add_item("English", load("res://assets/ui/flags/english.png"), true) # id : 0
|
||||
data.add_item("Français", load("res://assets/ui/flags/french.png"), true) # id : 1
|
||||
|
||||
data.select(Global.get_setting_language())
|
||||
|
||||
func _apply_settings_gyroscope():
|
||||
$VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(Global.get_setting_gyrosocpe())
|
||||
@@ -21,10 +27,32 @@ func _apply_settings_gyroscope():
|
||||
func _apply_settings_sound_ambient():
|
||||
$VBoxContainer/ambient_sound/HBoxContainer/data.set_pressed(Global.get_setting_ambient_sound())
|
||||
|
||||
func _apply_settings_resolution():
|
||||
var data = $VBoxContainer/resolution/VBoxContainer/data
|
||||
|
||||
data.add_item("2560 x 1440", null, true) # id : 0
|
||||
data.add_item("1920 x 1080", null, true) # id : 1
|
||||
data.add_item("1280 x 720", null, true) # id : 2
|
||||
data.add_item("854 x 576", null, true) # id : 3
|
||||
|
||||
for index in range(4):
|
||||
if data.get_item_text(index).split(' x ') == Global.get_setting_resolution():
|
||||
data.select(index)
|
||||
|
||||
func _apply_settings_fullscreen():
|
||||
$VBoxContainer/fullscreen/HBoxContainer/data.set_pressed(Global.get_setting_fullscreen())
|
||||
|
||||
func _on_gyroscope_pressed():
|
||||
print("[Settings#_on_gyroscope_pressed] change value to database ...........")
|
||||
Global.set_setting_gyroscope(int($VBoxContainer/gyroscope/HBoxContainer/data.pressed))
|
||||
|
||||
func _on_ambient_sound_pressed():
|
||||
print("[Settings#_on_ambient_sound_pressed] change value to database ...........")
|
||||
Global.set_setting_ambient_sound(int($VBoxContainer/ambient_sound/HBoxContainer/data.pressed))
|
||||
|
||||
func _on_langue_item_selected(index):
|
||||
Global.set_setting_language(index)
|
||||
|
||||
func _on_resolution_item_selected(index):
|
||||
Global.set_setting_resolution($VBoxContainer/resolution/VBoxContainer/data.get_item_text(index))
|
||||
|
||||
func _on_fullscreen_item_selected():
|
||||
Global.set_setting_fullscreen(int($VBoxContainer/fullscreen/HBoxContainer/data.pressed))
|
||||
|
||||
@@ -14,38 +14,48 @@ __meta__ = {
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_left = 547.0
|
||||
margin_top = 309.0
|
||||
margin_top = 265.0
|
||||
margin_right = 732.0
|
||||
margin_bottom = 411.0
|
||||
margin_bottom = 455.0
|
||||
alignment = 1
|
||||
|
||||
[node name="Langue" type="CenterContainer" parent="VBoxContainer"]
|
||||
[node name="langue" type="CenterContainer" parent="VBoxContainer"]
|
||||
margin_right = 185.0
|
||||
margin_bottom = 14.0
|
||||
margin_bottom = 27.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Langue"]
|
||||
margin_left = 58.0
|
||||
margin_right = 127.0
|
||||
margin_bottom = 14.0
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/langue"]
|
||||
margin_left = 67.0
|
||||
margin_right = 117.0
|
||||
margin_bottom = 27.0
|
||||
__meta__ = {
|
||||
"_editor_description_": ""
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Langue/HBoxContainer"]
|
||||
[node name="Label" type="Label" parent="VBoxContainer/langue/VBoxContainer"]
|
||||
margin_right = 50.0
|
||||
margin_bottom = 14.0
|
||||
text = "langue :"
|
||||
align = 1
|
||||
|
||||
[node name="data" type="Label" parent="VBoxContainer/Langue/HBoxContainer"]
|
||||
margin_left = 54.0
|
||||
margin_right = 69.0
|
||||
margin_bottom = 14.0
|
||||
text = "FR"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[node name="data" type="ItemList" parent="VBoxContainer/langue/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 50.0
|
||||
margin_bottom = 27.0
|
||||
auto_height = true
|
||||
max_columns = 2
|
||||
same_column_width = true
|
||||
fixed_icon_size = Vector2( 32, 32 )
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/langue"]
|
||||
margin_left = 92.0
|
||||
margin_top = 13.0
|
||||
margin_right = 92.0
|
||||
margin_bottom = 13.0
|
||||
|
||||
[node name="gyroscope" type="CenterContainer" parent="VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_top = 31.0
|
||||
margin_right = 185.0
|
||||
margin_bottom = 58.0
|
||||
margin_bottom = 71.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/gyroscope"]
|
||||
margin_left = 16.0
|
||||
@@ -65,9 +75,9 @@ margin_bottom = 40.0
|
||||
align = 1
|
||||
|
||||
[node name="ambient_sound" type="CenterContainer" parent="VBoxContainer"]
|
||||
margin_top = 62.0
|
||||
margin_top = 75.0
|
||||
margin_right = 185.0
|
||||
margin_bottom = 102.0
|
||||
margin_bottom = 115.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ambient_sound"]
|
||||
margin_right = 185.0
|
||||
@@ -84,5 +94,53 @@ margin_left = 109.0
|
||||
margin_right = 185.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="resolution" type="CenterContainer" parent="VBoxContainer"]
|
||||
margin_top = 119.0
|
||||
margin_right = 185.0
|
||||
margin_bottom = 146.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/resolution"]
|
||||
margin_left = 54.0
|
||||
margin_right = 130.0
|
||||
margin_bottom = 27.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/resolution/VBoxContainer"]
|
||||
margin_right = 76.0
|
||||
margin_bottom = 14.0
|
||||
text = "Resolution :"
|
||||
|
||||
[node name="data" type="ItemList" parent="VBoxContainer/resolution/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 76.0
|
||||
margin_bottom = 27.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
auto_height = true
|
||||
same_column_width = true
|
||||
|
||||
[node name="fullscreen" type="CenterContainer" parent="VBoxContainer"]
|
||||
margin_top = 150.0
|
||||
margin_right = 185.0
|
||||
margin_bottom = 190.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/fullscreen"]
|
||||
margin_left = 15.0
|
||||
margin_right = 169.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/fullscreen/HBoxContainer"]
|
||||
margin_top = 13.0
|
||||
margin_right = 74.0
|
||||
margin_bottom = 27.0
|
||||
text = "Fullscreen :"
|
||||
|
||||
[node name="data" type="CheckButton" parent="VBoxContainer/fullscreen/HBoxContainer"]
|
||||
margin_left = 78.0
|
||||
margin_right = 154.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[connection signal="item_selected" from="VBoxContainer/langue/VBoxContainer/data" to="." method="_on_langue_item_selected"]
|
||||
[connection signal="pressed" from="VBoxContainer/gyroscope/HBoxContainer/data" to="." method="_on_gyroscope_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ambient_sound/HBoxContainer/data" to="." method="_on_ambient_sound_pressed"]
|
||||
[connection signal="item_selected" from="VBoxContainer/resolution/VBoxContainer/data" to="." method="_on_resolution_item_selected"]
|
||||
[connection signal="pressed" from="VBoxContainer/fullscreen/HBoxContainer/data" to="." method="_on_fullscreen_item_selected"]
|
||||
|
||||
+26
-13
@@ -11,20 +11,31 @@ onready var table = Global.database.get_table_by_name("scenes")
|
||||
onready var meshes = {}
|
||||
onready var from = null
|
||||
onready var to = null
|
||||
onready var mlevel = load("res://db/MLevel.gd")
|
||||
onready var mscene = load("res://db/MScene.gd")
|
||||
onready var victory_condition = 0
|
||||
onready var victory_progress = 0
|
||||
|
||||
func _ready():
|
||||
_load_translations()
|
||||
_load_meshes()
|
||||
_prepare_victory_condition()
|
||||
|
||||
func _prepare_victory_condition():
|
||||
var level = mlevel.new(Global.current_scene_int)
|
||||
|
||||
victory_condition = level.object_to_find()
|
||||
victory_progress = level.object_finding()
|
||||
|
||||
func _process(_delta):
|
||||
_check_dissolve_mesh()
|
||||
_check_change_angle_camera()
|
||||
_check_victory_condition()
|
||||
|
||||
func _check_dissolve_mesh():
|
||||
# Event dissolve in object searched by gamer
|
||||
for key in meshes:
|
||||
if meshes[key].lock() == true and meshes[key].mesh() != null:
|
||||
if bool(meshes[key].lock()) == true and meshes[key].mesh() != null:
|
||||
if meshes[key].tick_reference() == 0:
|
||||
meshes[key].set_tick_reference(OS.get_ticks_msec())
|
||||
|
||||
@@ -32,15 +43,10 @@ func _check_dissolve_mesh():
|
||||
meshes[key].set_value(meshes[key].value() + 0.01)
|
||||
_node_to_mesh(key).get_surface_material(0).set("shader_param/dissolve_amount", meshes[key].value())
|
||||
else:
|
||||
victory_progress = mlevel.new(Global.current_scene_int).object_finding()
|
||||
_node_to_mesh(key).call_deferred("free")
|
||||
meshes[key].set_mesh(null)
|
||||
|
||||
func _node_to_mesh(key):
|
||||
return get_node(meshes[key].mesh())
|
||||
|
||||
func _node_to_area(key):
|
||||
return get_node(meshes[key].mesh()+"/Area")
|
||||
|
||||
func _check_change_angle_camera():
|
||||
var camera = $"Main Camera"
|
||||
var gyroscope = Input.get_gyroscope()
|
||||
@@ -104,12 +110,22 @@ func _gyroscope_changed_up(gyroscope):
|
||||
gyroscope.x < gyroscope_value_old.x
|
||||
|
||||
func _start_dissolve(key):
|
||||
if meshes[key].lock() == false:
|
||||
meshes[key].set_lock(true)
|
||||
if bool(meshes[key].lock()) == false:
|
||||
meshes[key].set_lock(int(true))
|
||||
$ObjectFind.stream = meshes[key].audio_sound()
|
||||
$ObjectFind.play()
|
||||
|
||||
## PRIVATE
|
||||
func _check_victory_condition():
|
||||
if victory_condition == victory_progress:
|
||||
print("[levels#_check_victory_condition] \\o/")
|
||||
Global.goto_scene("res://scenes/UI/ending.tscn")
|
||||
|
||||
func _node_to_mesh(key):
|
||||
return get_node(meshes[key].mesh())
|
||||
|
||||
func _node_to_area(key):
|
||||
return get_node(meshes[key].mesh()+"/Area")
|
||||
|
||||
func _load_translations():
|
||||
pass
|
||||
|
||||
@@ -122,9 +138,6 @@ func _load_meshes():
|
||||
if scene_detail.key() != null:
|
||||
meshes[scene_detail.key()] = scene_detail
|
||||
|
||||
for key in meshes:
|
||||
meshes[key].search_keys()
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton or event is InputEventScreenTouch:
|
||||
var camera = $"Main Camera"
|
||||
|
||||
@@ -13,33 +13,30 @@ func _ready():
|
||||
func _display_hud_menu():
|
||||
var counter = 0
|
||||
var scene = null
|
||||
var label_id = null
|
||||
var label_counter = null
|
||||
|
||||
for key in meshes:
|
||||
scene = meshes[key]
|
||||
_create_button_info(scene, counter, label_id)
|
||||
label_id = scene.label_id()
|
||||
counter = +1
|
||||
_create_button_info(scene, counter, label_counter)
|
||||
label_counter = scene.label_counter()
|
||||
counter = counter + 1
|
||||
|
||||
# Back to main scene
|
||||
func _on_TextureButton_pressed():
|
||||
Global.goto_scene("res://scenes/main.tscn")
|
||||
|
||||
func _create_button_info(scene, counter, label_id):
|
||||
func _create_button_info(scene, counter, label_counter):
|
||||
var btn = null
|
||||
|
||||
if counter == 0:
|
||||
btn = object_first.instance()
|
||||
#print("[warCraft#_create_button_info] ["+String(counter)+"] use first")
|
||||
elif counter == meshes.size() - 1:
|
||||
btn = object_last.instance()
|
||||
#print("[warCraft#_create_button_info] ["+String(counter)+"] use last")
|
||||
else:
|
||||
btn = object_std.instance()
|
||||
#print("[warCraft#_create_button_info] ["+String(counter)+"] use standar")
|
||||
|
||||
if label_id != null and label_id == scene.label_id():
|
||||
last_btn.get_node("Label").set_text(last_btn.get_node("Label").text + " X")
|
||||
if label_counter != null and label_counter == scene.label_counter():
|
||||
last_btn.get_node("Label").set_text(last_btn.get_node("Label").text + " " + String(scene.counter()))
|
||||
else:
|
||||
$ListObjects/ListContainer.add_child(btn)
|
||||
btn.get_node("Label").set_text(scene.label())
|
||||
|
||||
@@ -270,7 +270,7 @@ cell_center_y = false
|
||||
cell_center_z = false
|
||||
baked_meshes = [ SubResource( 4 ) ]
|
||||
data = {
|
||||
"cells": PoolIntArray( 0, 0, 0, 65531, 0, 3, 65532, 0, 0, 65533, 0, 0, 65534, 0, 0, 65535, 0, 0, 0, 1, 0, 65531, 1, 3, 65532, 1, 0, 65533, 1, 0, 65534, 1, 0, 65535, 1, 0, 0, 2, 0, 65531, 2, 3, 65532, 2, 0, 65533, 2, 0, 65534, 2, 0, 65535, 2, 0, 0, 65533, 0, 65532, 65533, 0, 65533, 65533, 0, 65534, 65533, 0, 65535, 65533, 0, 0, 65534, 0, 65531, 65534, 3, 65532, 65534, 0, 65533, 65534, 0, 65534, 65534, 0, 65535, 65534, 0, 0, 65535, 0, 65531, 65535, 3, 65532, 65535, 0, 65533, 65535, 0, 65534, 65535, 0, 65535, 65535, 0 )
|
||||
"cells": PoolIntArray( 0, 0, 0, 65531, 0, -1610612733, 65532, 0, 0, 65533, 0, -1610612736, 65534, 0, 0, 65535, 0, 0, 0, 1, 0, 65531, 1, 3, 65532, 1, 0, 65533, 1, 0, 65534, 1, 0, 65535, 1, 0, 0, 2, 0, 65531, 2, 3, 65532, 2, 0, 65533, 2, 0, 65534, 2, 0, 65535, 2, 0, 0, 65533, 0, 65532, 65533, 0, 65533, 65533, 0, 65534, 65533, 0, 65535, 65533, 0, 0, 65534, 0, 65531, 65534, 3, 65532, 65534, 0, 65533, 65534, 0, 65534, 65534, 0, 65535, 65534, 0, 0, 65535, 0, 65531, 65535, 1073741827, 65532, 65535, 0, 65533, 65535, 0, 65534, 65535, 0, 65535, 65535, 0 )
|
||||
}
|
||||
__meta__ = {
|
||||
"_editor_clip_": 0,
|
||||
|
||||
Reference in New Issue
Block a user