extends VBoxContainer
class_name ChoicesBox

signal choice_made

func on_choice_made(marker):
	emit_signal("choice_made", marker)

func on_choices(choices_list):
	show()
	for choice in choices_list:
		var choiceButton := Button.new()
		choiceButton.text = choice["text"]
		choiceButton.connect("pressed", self, "on_choice_made", [choice])
		add_child(choiceButton)
	var res = yield(self, "choice_made")
	hide()
	
	clear()
	return res

func clear():
	for child in get_children():
		child.queue_free()
