This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
Jessist/addons/dialogue_manager/views/choose_title_dialog.gd
2022-06-18 13:05:48 +02:00

43 lines
763 B
GDScript

tool
extends WindowDialog
signal title_chosen(title)
const TitleList = preload("res://addons/dialogue_manager/components/title_list.gd")
var chosen_title: String = ""
onready var title_list: TitleList = $Margin/VBox/TitleList
func choose_a_title(titles: Array) -> void:
title_list.titles = titles
popup_centered()
title_list.focus_filter()
### Signals
func _on_TitleList_title_clicked(title):
chosen_title = title
func _on_TitleList_title_dbl_clicked(title):
# Consume the double click so our selection behind the dialog doesn't change
yield(get_tree(), "idle_frame")
emit_signal("title_chosen", title)
hide()
func _on_ChooseButton_pressed():
emit_signal("title_chosen", chosen_title)
hide()
func _on_CancelButton_pressed():
hide()