Files
tgcc/core/game_menu/highlighted_photo.gd
2026-06-30 20:01:13 +00:00

33 lines
782 B
GDScript

extends Control
@onready var photo: Photo = $%Photo
@onready var panel: Panel = $%Panel
var is_closing: bool = false
func _ready() -> void:
GameState.on_photo_highlighted.connect(_on_photo_highlighted)
func _on_photo_highlighted(texture: Texture) -> void:
if texture != photo.texture_rect.texture:
show()
photo.scale = Vector2.ONE
TweenFX.fold_in(photo)
photo.setup(texture)
func _input(event: InputEvent) -> void:
if not visible:
return
if event is InputEventMouse:
get_viewport().set_input_as_handled()
if is_closing:
return
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
is_closing = true
await TweenFX.fold_out(photo).finished
photo.texture_rect.texture = null
hide()
is_closing = false