fix: renaming a collection only renames selected one
This commit is contained in:
parent
15b56ef048
commit
cf7669fadc
9 changed files with 51 additions and 30 deletions
|
|
@ -1,18 +1,27 @@
|
|||
class_name UIManager extends HBoxContainer
|
||||
|
||||
@export_category("Main Panel")
|
||||
@export var current_active_panel: MainPanel
|
||||
@export var panel_array: Array[MainPanel] = []
|
||||
@export var container_collection_box: ContainerBox
|
||||
|
||||
@export var main_panel_scene: PackedScene
|
||||
|
||||
@export_category("Container Selection")
|
||||
@export var container_collection_box: ContainerBox
|
||||
@export var container_selection_buttons: Array[ContainerSelectionButton] = []
|
||||
@export var container_button_scene: PackedScene
|
||||
|
||||
var instantiated_window: Window
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
current_active_panel.id = 1
|
||||
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)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
|
@ -22,7 +31,7 @@ func _process(delta: float) -> void:
|
|||
|
||||
func _on_panel_created() -> void:
|
||||
var new_panel: MainPanel = main_panel_scene.instantiate()
|
||||
new_panel.id = panel_array.size() + 1
|
||||
new_panel.id = panel_array.size()
|
||||
panel_array.append(new_panel)
|
||||
|
||||
func _on_panel_requested(index: int) -> void:
|
||||
|
|
@ -38,3 +47,16 @@ func _on_panel_requested(index: int) -> void:
|
|||
current_active_panel.show()
|
||||
|
||||
|
||||
func _on_new_container_requested() -> void:
|
||||
var new_button: ContainerSelectionButton = container_button_scene.instantiate()
|
||||
new_button.container_box = container_collection_box
|
||||
container_selection_buttons.append(new_button)
|
||||
new_button.button_index = container_selection_buttons.find(new_button)
|
||||
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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue