You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
510 B

  1. extends VBoxContainer
  2. class_name ChoicesBox
  3. signal choice_made
  4. func on_choice_made(marker):
  5. emit_signal("choice_made", marker)
  6. func on_choices(choices_list):
  7. show()
  8. for choice in choices_list:
  9. var choiceButton := Button.new()
  10. choiceButton.text = choice["text"]
  11. choiceButton.connect("pressed", self, "on_choice_made", [choice["marker"]])
  12. add_child(choiceButton)
  13. var res = yield(self, "choice_made")
  14. hide()
  15. clear()
  16. return res
  17. func clear():
  18. for child in get_children():
  19. child.queue_free()