update and improve ui

This commit was merged in pull request #36.
This commit is contained in:
2026-06-27 11:54:01 +00:00
parent 97bbca95e8
commit c0a68da7d1
21 changed files with 470 additions and 129 deletions

View File

@@ -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)

View File

@@ -121,6 +121,7 @@ func take_photo_async() -> void:
var targets = get_tree().get_nodes_in_group("collectible")
var space_state = get_world_3d().direct_space_state
CollectionManager.on_photo_preview_ready.emit(captured_image)
CollectionManager.save_photo_to_disk_async(captured_image)
for target in targets:
@@ -138,6 +139,10 @@ func take_photo_async() -> void:
CollectionManager.unlock_collectible(target.collectible_data.id)
GameState.save_game()
var shutter_stay_duration = 0.15
await get_tree().create_timer(shutter_stay_duration).timeout
GameState.on_photo_taken_finished.emit()
func _on_photo_mode_black_screen_disappeared() -> void: