31 lines
635 B
GDScript
31 lines
635 B
GDScript
@tool
|
|
extends VBoxContainer
|
|
class_name GuiWindow
|
|
|
|
signal closed
|
|
|
|
@export var title : String : set = update_title
|
|
@export_tool_button("Open", "Callable") var open_action = open_window
|
|
@export_tool_button("Close", "Callable") var close_action = close_window
|
|
|
|
func _ready():
|
|
update_title(title)
|
|
|
|
func update_title(text : String):
|
|
title = text
|
|
if (is_node_ready()):
|
|
%WindowTitle.text = title
|
|
|
|
func _on_close_button_pressed():
|
|
close_window()
|
|
|
|
func open_window():
|
|
show()
|
|
%ControlAnimationPlayer.appear()
|
|
|
|
func close_window():
|
|
%ControlAnimationPlayer.disappear(0.3)
|
|
await get_tree().create_timer(0.3).timeout
|
|
hide()
|
|
closed.emit()
|