2021-11-20 11:47:14 +01:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
func _ready():
|
2021-11-25 21:13:06 +01:00
|
|
|
$RichTextLabel/Logo.hide()
|
2021-11-20 22:29:24 +01:00
|
|
|
$VBoxContainer/ButtonTemplate.hide()
|
2021-11-20 11:47:14 +01:00
|
|
|
|
2021-11-27 18:02:47 +01:00
|
|
|
$Wol.connect('line', self, '_on_line')
|
2021-11-27 22:05:24 +01:00
|
|
|
$Wol.connect('options', self, '_on_options')
|
2021-11-27 18:02:47 +01:00
|
|
|
$Wol.connect('finished', self, '_on_finished')
|
|
|
|
|
2021-11-20 12:20:33 +01:00
|
|
|
func continue_dialogue():
|
|
|
|
if $Tween.is_active():
|
|
|
|
$Tween.remove_all()
|
|
|
|
$RichTextLabel.percent_visible = 1.0
|
|
|
|
return
|
|
|
|
|
|
|
|
$Wol.resume()
|
|
|
|
|
2021-11-27 18:02:47 +01:00
|
|
|
func _on_line(line):
|
2021-11-25 21:13:06 +01:00
|
|
|
$RichTextLabel.bbcode_text = line.text
|
2021-11-20 12:20:33 +01:00
|
|
|
|
|
|
|
$Tween.remove_all()
|
|
|
|
$Tween.interpolate_property(
|
|
|
|
$RichTextLabel,
|
|
|
|
'percent_visible',
|
|
|
|
.0,
|
|
|
|
1.0,
|
|
|
|
.02 * line.text.length()
|
|
|
|
)
|
|
|
|
|
|
|
|
$Tween.start()
|
|
|
|
|
2021-11-27 18:02:47 +01:00
|
|
|
func _on_options(options):
|
2021-11-20 22:29:24 +01:00
|
|
|
var button_template = $VBoxContainer/ButtonTemplate
|
|
|
|
|
|
|
|
for option in options:
|
|
|
|
var button = button_template.duplicate()
|
|
|
|
button.text = option.line.text
|
|
|
|
button.name = 'Option%d' % option.id
|
|
|
|
|
|
|
|
$VBoxContainer.add_child(button)
|
|
|
|
button.connect('pressed', self, '_on_option_selected', [option])
|
|
|
|
button.show()
|
|
|
|
|
|
|
|
func _on_option_selected(option):
|
|
|
|
$Wol.select_option(option.id)
|
|
|
|
|
|
|
|
for child in $VBoxContainer.get_children():
|
|
|
|
if not 'Template' in child.name:
|
|
|
|
child.queue_free()
|
|
|
|
|
2021-11-27 18:02:47 +01:00
|
|
|
func _on_finished():
|
2021-11-20 22:29:24 +01:00
|
|
|
$RichTextLabel.text = ''
|
2021-11-20 12:20:33 +01:00
|
|
|
|
|
|
|
func _input(event):
|
|
|
|
if event is InputEventKey and event.scancode == KEY_ENTER and event.pressed:
|
|
|
|
continue_dialogue()
|