class_name Notice extends Control @onready var _messages := ( $'CenterContainer/PanelContainer/VBoxContainer/ScrollContainer/Messages' ) as VBoxContainer @onready var _button_ok := ( $'CenterContainer/PanelContainer/VBoxContainer/Nav/OK' ) as Button func _ready() -> void: _button_ok.pressed.connect(_on_ok) func _on_ok() -> void: UI.Return(self, true) func add_message(text: String) -> Label: var label := Label.new() label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER label.text = text _messages.add_child(label) return label func add_selectable(text: String) -> TextEdit: var textedit := TextEdit.new() textedit.text = text textedit.selecting_enabled = true textedit.editable = false textedit.scroll_fit_content_height = true _messages.add_child(textedit) return textedit func add_link(text: String) -> LinkButton: var linkbutton := LinkButton.new() linkbutton.text = text linkbutton.uri = text linkbutton.size_flags_horizontal = Control.SIZE_SHRINK_CENTER _messages.add_child(linkbutton) return linkbutton