Initial commit
This commit is contained in:
commit
7becdd23b6
989 changed files with 28526 additions and 0 deletions
29
scenes/ui_elements/prompt.gd
Normal file
29
scenes/ui_elements/prompt.gd
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
extends CanvasLayer
|
||||
|
||||
signal prompt_option_selected(option_label, option_text)
|
||||
|
||||
var prompt_option_scene: PackedScene = preload("res://scenes/ui_elements/prompt_option.tscn")
|
||||
|
||||
func clear_options():
|
||||
for child in $VBoxContainer.get_children():
|
||||
child.queue_free()
|
||||
|
||||
func show_prompt():
|
||||
visible = true
|
||||
$AnimationPlayer.play("show_prompt")
|
||||
await $AnimationPlayer.animation_finished
|
||||
var first_option = $VBoxContainer.get_child(0)
|
||||
if first_option:
|
||||
first_option.get_child(0).grab_focus()
|
||||
|
||||
func hide_prompt():
|
||||
visible = false
|
||||
$AnimationPlayer.play_backwards("show_prompt")
|
||||
|
||||
func create_option(option_label: String, option_text: String):
|
||||
var option = prompt_option_scene.instantiate()
|
||||
option.init_option(self, option_label, option_text)
|
||||
$VBoxContainer.add_child(option)
|
||||
|
||||
func on_option_selected(label: String, text: String):
|
||||
prompt_option_selected.emit(label, text)
|
||||
Loading…
Add table
Add a link
Reference in a new issue