improve ui and bug fix
This commit is contained in:
26
core/main_scene_ui/photo_taken.gd
Normal file
26
core/main_scene_ui/photo_taken.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user