27 lines
689 B
GDScript
27 lines
689 B
GDScript
extends Control
|
|
|
|
@onready var photo_texture: TextureRect = $%PhotoTexture
|
|
|
|
func _ready() -> void:
|
|
GameState.on_photo_taken_prepare.connect(_hide_photo_taken)
|
|
GameState.on_photo_taken_finished.connect(_show_photo_taken)
|
|
CollectionManager.on_photo_saved.connect(_set_photo_taken)
|
|
|
|
func _hide_photo_taken() -> void:
|
|
hide()
|
|
|
|
func _set_photo_taken(file_path) -> void:
|
|
var image = Image.load_from_file(file_path)
|
|
if image:
|
|
var texture = ImageTexture.create_from_image(image)
|
|
photo_texture.texture = texture
|
|
|
|
func _show_photo_taken() -> void:
|
|
scale = Vector2(1,1)
|
|
modulate.a = 1.0
|
|
rotation_degrees = 0.0
|
|
show()
|
|
var tween = TweenFX.explode(self, 5, 3)
|
|
await tween.finished
|
|
hide()
|