dialog.gd 566 B

1234567891011121314151617181920212223
  1. extends Panel
  2. @onready var options := $options
  3. @onready var text_label := $RichTextLabel
  4. func set_text(text: String):
  5. options.visible = false
  6. text_label.visible = true
  7. text_label.text = text
  8. func clear_options():
  9. for child in options.get_node("HFlowContainer").get_children():
  10. child.queue_free()
  11. func add_option(text: String, callback: Callable):
  12. var option = Button.new()
  13. option.text = text
  14. option.pressed.connect(callback)
  15. options.get_node("HFlowContainer").add_child(option)
  16. func show_options():
  17. options.visible = true
  18. text_label.visible = false