fix: adding entries should work properly now
This commit is contained in:
parent
3fa14dc268
commit
6ce640fce2
6 changed files with 21 additions and 8 deletions
|
|
@ -10,6 +10,8 @@ signal edit_window_closed
|
|||
signal edit_window_requested(window: Window, text: String, node: Node)
|
||||
signal edit_window_text_saved(window: Window, text: String, node: Node)
|
||||
|
||||
signal emit_id(id: int)
|
||||
|
||||
signal main_panel_color_changed(color: Color)
|
||||
signal main_window_color_changed(color: Color)
|
||||
signal side_panel_color_changed(color: Color)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ func _on_popup_menu_index_pressed(index: int) -> void:
|
|||
if index == 0:
|
||||
instantiated_menu = edit_collection_name_window.instantiate()
|
||||
add_child(instantiated_menu)
|
||||
SignalBus.edit_window_requested.emit(instantiated_menu, button.text, button_index)
|
||||
SignalBus.edit_window_requested.emit(instantiated_menu, button.text, self)
|
||||
SignalBus.emit_id.emit(button_index)
|
||||
|
||||
|
||||
func _on_window_closed(window: Window) -> void:
|
||||
|
|
|
|||
|
|
@ -37,5 +37,4 @@ func on_edit_window_closed(window: Window) -> void:
|
|||
if not is_instance_of(window, Editmenu):
|
||||
return
|
||||
if instantiated_menu != null:
|
||||
SignalBus.on_entry_deleted.emit(self)
|
||||
instantiated_menu.queue_free()
|
||||
|
|
|
|||
|
|
@ -62,15 +62,18 @@ func _on_new_container_requested() -> void:
|
|||
container_collection_box.move_child(new_button, -2)
|
||||
|
||||
func _on_edit_window_text_saved(window: Window, text: String, node: Node) -> void:
|
||||
print("save: ", text)
|
||||
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)
|
||||
rename_container_text_box_when_button_is_renamed(i)
|
||||
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
|
||||
else:
|
||||
print("Else")
|
||||
|
||||
func rename_container_text_box_when_button_is_renamed(id) -> void:
|
||||
panel_array[id].container_name_label.text = container_selection_buttons[id].button.text
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@ class_name EditCollectionNameWindow extends Window
|
|||
|
||||
@export var text_edit: LineEdit
|
||||
|
||||
var id: Node
|
||||
var node: Node
|
||||
var id: int
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
SignalBus.edit_window_requested.connect(on_edit_window_requested)
|
||||
|
||||
SignalBus.emit_id.connect(_on_id_emitted)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
|
@ -20,15 +21,16 @@ func cancel() -> void:
|
|||
|
||||
|
||||
func save() -> void:
|
||||
SignalBus.edit_window_text_saved.emit(self, text_edit.text, id)
|
||||
SignalBus.edit_window_text_saved.emit(self, text_edit.text, node)
|
||||
SignalBus.on_window_closed.emit(self)
|
||||
|
||||
|
||||
func on_edit_window_requested(window: Window, text: String, edit_id: Node) -> void:
|
||||
func on_edit_window_requested(window: Window, text: String, _node: Node) -> void:
|
||||
if not is_instance_of(window, EditCollectionNameWindow):
|
||||
return
|
||||
print(text)
|
||||
text_edit.text = text
|
||||
id = edit_id
|
||||
node = _node
|
||||
|
||||
|
||||
func _on_cancel_button_pressed() -> void:
|
||||
|
|
@ -36,3 +38,7 @@ func _on_cancel_button_pressed() -> void:
|
|||
|
||||
func _on_save_button_pressed() -> void:
|
||||
save()
|
||||
|
||||
|
||||
func _on_id_emitted(_id: int) -> void:
|
||||
id = _id
|
||||
|
|
@ -20,6 +20,7 @@ func _on_close_requested() -> void:
|
|||
func on_edit_window_requested(window: Window, text: String, _node: Node) -> void:
|
||||
if not is_instance_of(window, Editmenu):
|
||||
return
|
||||
print(text)
|
||||
node = _node
|
||||
text_edit.text = text
|
||||
|
||||
|
|
@ -42,6 +43,7 @@ func cancel() -> void:
|
|||
|
||||
func save() -> void:
|
||||
SignalBus.edit_window_text_saved.emit(self, text_edit.text, node)
|
||||
print(text_edit.text)
|
||||
SignalBus.on_window_closed.emit(self)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue