feat: rename container name
(remaining issue: renames every instance of the container_selection_button)
This commit is contained in:
parent
a47a818f8b
commit
15b56ef048
13 changed files with 164 additions and 20 deletions
|
|
@ -3,12 +3,15 @@ class_name ContainerSelectionButton extends MarginContainer
|
|||
@export var button: Button
|
||||
@export var container_box: ContainerBox
|
||||
@export var popup_menu: PopupMenu
|
||||
@export var edit_collection_name_window: PackedScene
|
||||
|
||||
var button_index: int
|
||||
var instantiated_menu
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass
|
||||
SignalBus.edit_window_text_saved.connect(_on_edit_window_text_saved)
|
||||
SignalBus.on_window_closed.connect(_on_window_closed)
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
|
|
@ -32,3 +35,23 @@ func _input(event: InputEvent) -> void:
|
|||
button.get_global_rect().size.x,
|
||||
button.get_global_rect().size.y)
|
||||
)
|
||||
|
||||
|
||||
func _on_popup_menu_index_pressed(index: int) -> void:
|
||||
if instantiated_menu != null:
|
||||
return
|
||||
if index == 0:
|
||||
instantiated_menu = edit_collection_name_window.instantiate()
|
||||
add_child(instantiated_menu)
|
||||
SignalBus.edit_window_requested.emit(instantiated_menu, button.text)
|
||||
|
||||
func _on_edit_window_text_saved(window: Window, text: String) -> void:
|
||||
if not is_instance_of(window, EditCollectionNameWindow):
|
||||
return
|
||||
button.text = text
|
||||
|
||||
func _on_window_closed(window: Window) -> void:
|
||||
if not is_instance_of(window, EditCollectionNameWindow):
|
||||
return
|
||||
if instantiated_menu != null:
|
||||
instantiated_menu.queue_free()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue