update and improve ui
This commit was merged in pull request #36.
This commit is contained in:
@@ -2,6 +2,7 @@ extends Node
|
||||
|
||||
signal on_collectible_unlocked(collectible_id: StringName)
|
||||
signal on_photo_saved(filePath: String)
|
||||
signal on_photo_preview_ready(image: Image)
|
||||
|
||||
@export var collectibles_library: CollectibleLibrary
|
||||
|
||||
@@ -35,14 +36,18 @@ func save_photo_to_disk_async(image: Image) -> void:
|
||||
if not image:
|
||||
return
|
||||
|
||||
|
||||
if not DirAccess.dir_exists_absolute("user://photos"):
|
||||
DirAccess.make_dir_absolute("user://photos")
|
||||
|
||||
var timestamp = str(Time.get_unix_time_from_system())
|
||||
var file_path = "user://photos/photo_" + timestamp + ".png"
|
||||
image.save_png(file_path)
|
||||
|
||||
WorkerThreadPool.add_task(func():
|
||||
image.save_png(file_path)
|
||||
call_deferred("_on_photo_saved_callback", file_path)
|
||||
)
|
||||
|
||||
func _on_photo_saved_callback(file_path: String) -> void:
|
||||
saved_photos.append(file_path)
|
||||
sync_save_data()
|
||||
on_photo_saved.emit(file_path)
|
||||
|
||||
Reference in New Issue
Block a user