feature/count-object-finding (#61)

Co-authored-by: Vaillant Jeremy <vaillant.jeremy@dev-crea.com>
Reviewed-on: Athena/game-source#61
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-30 15:04:33 +02:00
parent ed20465f39
commit 0f2540613b
4 changed files with 36 additions and 6 deletions
+7 -1
View File
@@ -4,11 +4,17 @@ Integrate scenes [Warcraft](https://www.artstation.com/artwork/9mZ65Q) in Androi
## Tips ## Tips
See log android : ### See log android :
``` ```
adb logcat -s godot adb logcat -s godot
``` ```
### Database
The database json is not tracking by git for changed.
See more information : https://stackoverflow.com/questions/3319479/can-i-git-commit-a-file-and-ignore-its-content-changes
## Resources ## Resources
* [ambient-sound-level-warcraft.mp3](https://cchound.com/audio/tavern-loop-one/) * [ambient-sound-level-warcraft.mp3](https://cchound.com/audio/tavern-loop-one/)
+2 -2
View File
@@ -11,7 +11,7 @@
{"name":"resolution","type":"3","auto_increment":"0"}, {"name":"resolution","type":"3","auto_increment":"0"},
{"name":"fullscreen","type":"0","auto_increment":"0"} {"name":"fullscreen","type":"0","auto_increment":"0"}
], ],
"data":["fr","0","0","1920 x 1080","0"] "data":["1","0","0","1280 x 720","0"]
}, },
{ {
"table_name":"levels", "table_name":"levels",
@@ -32,7 +32,7 @@
{"name":"label_counter","type":"1","auto_increment":"0"}, {"name":"label_counter","type":"1","auto_increment":"0"},
{"name":"counter","type":"1","auto_increment":"0"} {"name":"counter","type":"1","auto_increment":"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"] "data":["0","Dagger","dagger","0","dagger","0","1","0","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","0","Spyglass","spyglass","0","spyglass","2","1","0","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","0","Apple","apple4","0","apples/apple4","5","4","0","Beer","beer","0","beer","6","1","0","SuperDagger","gadder","1","sm_super_dager","0","1"]
} }
] ]
} }
+21 -3
View File
@@ -38,14 +38,18 @@ func _check_dissolve_mesh():
if bool(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: if meshes[key].tick_reference() == 0:
meshes[key].set_tick_reference(OS.get_ticks_msec()) meshes[key].set_tick_reference(OS.get_ticks_msec())
_node_object_list(key)
if OS.get_ticks_msec() < meshes[key].tick_reference() + TIME_MAX: if OS.get_ticks_msec() < meshes[key].tick_reference() + TIME_MAX:
meshes[key].set_value(meshes[key].value() + 0.01) 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()) _node_to_mesh(key).get_surface_material(0).set("shader_param/dissolve_amount", meshes[key].value())
else: else:
victory_progress = mlevel.new(Global.current_scene_int).object_finding() _clean_mesh(key)
_node_to_mesh(key).call_deferred("free")
meshes[key].set_mesh(null) func _clean_mesh(key):
victory_progress = mlevel.new(Global.current_scene_int).object_finding()
_node_to_mesh(key).call_deferred("free")
meshes[key].set_mesh(null)
func _check_change_angle_camera(): func _check_change_angle_camera():
var camera = $"Main Camera" var camera = $"Main Camera"
@@ -126,6 +130,20 @@ func _node_to_mesh(key):
func _node_to_area(key): func _node_to_area(key):
return get_node(meshes[key].mesh()+"/Area") return get_node(meshes[key].mesh()+"/Area")
func _node_object_list(key):
for child in $ListObjects/ListContainer.get_children():
if child.get_meta("name") == meshes[key].label():
child.set_meta("counted", child.get_meta("counted") + 1)
if child.get_meta("counter") == child.get_meta("counted"):
child.visible = false
else:
var diff = child.get_meta("counter") - child.get_meta("counted")
var txt = child.get_meta("name")
if diff != 1:
txt = txt + " " + String(diff)
child.get_node("Label").set_text(txt)
func _load_translations(): func _load_translations():
pass pass
+6
View File
@@ -37,9 +37,15 @@ func _create_button_info(scene, counter, label_counter):
if label_counter != null and label_counter == scene.label_counter(): 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())) last_btn.get_node("Label").set_text(last_btn.get_node("Label").text + " " + String(scene.counter()))
last_btn.set_meta("name", scene.label())
last_btn.set_meta("counter", scene.counter())
last_btn.set_meta("counted", 0)
else: else:
$ListObjects/ListContainer.add_child(btn) $ListObjects/ListContainer.add_child(btn)
btn.get_node("Label").set_text(scene.label()) btn.get_node("Label").set_text(scene.label())
btn.set_meta("name", scene.label())
btn.set_meta("counter", scene.counter())
btn.set_meta("counted", 0)
last_btn = btn last_btn = btn