feat: add multiple done boxes
bug: can edit the text only once for whatever reason?
This commit is contained in:
parent
cf7669fadc
commit
3fa14dc268
16 changed files with 215 additions and 48 deletions
|
|
@ -1,5 +1,7 @@
|
|||
class_name UIManager extends HBoxContainer
|
||||
|
||||
const uuid_util = preload('res://addons/uuid/uuid.gd')
|
||||
|
||||
@export_category("Main Panel")
|
||||
@export var current_active_panel: MainPanel
|
||||
@export var panel_array: Array[MainPanel] = []
|
||||
|
|
@ -14,14 +16,15 @@ var instantiated_window: Window
|
|||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
current_active_panel.id = 0
|
||||
panel_array.append(current_active_panel)
|
||||
#current_active_panel.id = 0
|
||||
#panel_array.append(current_active_panel)
|
||||
|
||||
SignalBus.on_panel_created.connect(_on_panel_created)
|
||||
SignalBus.on_panel_requested.connect(_on_panel_requested)
|
||||
SignalBus.on_new_container_requested.connect(_on_new_container_requested)
|
||||
|
||||
SignalBus.edit_window_text_saved.connect(_on_edit_window_text_saved)
|
||||
#SignalBus.on_entry_deleted.connect(on_entry_deleted)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
|
@ -31,15 +34,18 @@ func _process(delta: float) -> void:
|
|||
|
||||
func _on_panel_created() -> void:
|
||||
var new_panel: MainPanel = main_panel_scene.instantiate()
|
||||
new_panel.id = panel_array.size()
|
||||
new_panel.id = uuid_util.v4()
|
||||
panel_array.append(new_panel)
|
||||
|
||||
func _on_panel_requested(index: int) -> void:
|
||||
func _on_panel_requested(index) -> void:
|
||||
if current_active_panel == panel_array[index]:
|
||||
print("Already active")
|
||||
return
|
||||
print("Panel: %d requested" % index)
|
||||
current_active_panel.hide()
|
||||
|
||||
if current_active_panel != null:
|
||||
current_active_panel.hide()
|
||||
|
||||
current_active_panel = panel_array[index]
|
||||
if not current_active_panel.is_inside_tree():
|
||||
add_child(current_active_panel)
|
||||
|
|
@ -55,8 +61,18 @@ func _on_new_container_requested() -> void:
|
|||
container_collection_box.add_child(new_button)
|
||||
container_collection_box.move_child(new_button, -2)
|
||||
|
||||
func _on_edit_window_text_saved(window: Window, text: String, edit_id: int) -> void:
|
||||
if not is_instance_of(window, EditCollectionNameWindow):
|
||||
return
|
||||
container_selection_buttons[edit_id].button.text = text
|
||||
func _on_edit_window_text_saved(window: Window, text: String, node: Node) -> void:
|
||||
if is_instance_of(window, EditCollectionNameWindow):
|
||||
var i: int = container_selection_buttons.find(node)
|
||||
container_selection_buttons[i].button.text = text
|
||||
rename_container_text_box_when_button_is_renamed(node)
|
||||
elif is_instance_of(window, Editmenu):
|
||||
for panel in panel_array:
|
||||
if panel.done_boxes.has(node):
|
||||
var i: int = panel.done_boxes.find(node)
|
||||
panel.done_boxes[i].entry_text_box.text = text
|
||||
|
||||
func rename_container_text_box_when_button_is_renamed(id) -> void:
|
||||
panel_array[id].container_name_label.text = container_selection_buttons[id].button.text
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue