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.

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