39 lines
1,009 B
GDScript
39 lines
1,009 B
GDScript
class_name DoneBox extends HBoxContainer
|
|
|
|
@export var edit_menu: PackedScene
|
|
@export var options_menu: MenuButton
|
|
|
|
@export var entry_text_box: RichTextLabel
|
|
|
|
var instantiated_menu
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
options_menu.get_popup().id_pressed.connect(_on_index_pressed)
|
|
|
|
SignalBus.edit_window_text_saved.connect(on_edit_window_text_save)
|
|
SignalBus.edit_window_closed.connect(on_edit_window_closed)
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
func _on_index_pressed(index:int) -> void:
|
|
if instantiated_menu != null:
|
|
return
|
|
if index == 0:
|
|
instantiated_menu = edit_menu.instantiate()
|
|
add_child(instantiated_menu)
|
|
SignalBus.edit_window_requested.emit(entry_text_box.text)
|
|
if index == 1:
|
|
queue_free()
|
|
|
|
|
|
func on_edit_window_text_save(text: String) -> void:
|
|
entry_text_box.text = text
|
|
|
|
func on_edit_window_closed() -> void:
|
|
instantiated_menu.queue_free()
|