46 lines
1.3 KiB
GDScript
46 lines
1.3 KiB
GDScript
extends Control
|
|
|
|
|
|
export(String) var choice_name = ""
|
|
export(String) var dilemma_name = ""
|
|
export(String) var dilemma_description = ""
|
|
export(float) var deferred_show = 0
|
|
|
|
onready var tween = $Tween
|
|
onready var hover_control = $HoverControl
|
|
onready var timer = $Timer
|
|
onready var container = $VBoxContainer
|
|
onready var choice_label = $VBoxContainer/ChoiceLabel
|
|
onready var dilemma_label = $VBoxContainer/DilemmaLabel
|
|
onready var texture = $VBoxContainer/TextureRect
|
|
|
|
|
|
func _ready():
|
|
container.hide()
|
|
choice_label.text = choice_name
|
|
dilemma_label.text = dilemma_name
|
|
hover_control.selection_object = texture
|
|
hover_control.infobox_position = "top"
|
|
hover_control.info_panel.title = dilemma_name
|
|
hover_control.info_panel.content = dilemma_description
|
|
|
|
tween.interpolate_property(container, "rect_scale", Vector2(0, 0), Vector2(1, 1), 1, Tween.TRANS_ELASTIC, Tween.EASE_IN_OUT)
|
|
tween.interpolate_property(container, "rect_position", Vector2(75, 75), Vector2(0, 0), 1, Tween.TRANS_ELASTIC, Tween.EASE_IN_OUT)
|
|
|
|
if deferred_show > 0:
|
|
timer.wait_time = deferred_show
|
|
timer.start()
|
|
else:
|
|
start_anim()
|
|
|
|
func start_anim():
|
|
container.rect_scale = Vector2(0, 0)
|
|
container.rect_position = Vector2(75, 75)
|
|
container.show()
|
|
tween.start()
|
|
|
|
|
|
func _on_Timer_timeout():
|
|
start_anim()
|
|
|
|
|