Skip to content

DynamicDictionaryEditor ​

Inherits: VBoxContainer

Reusable component for editing dictionaries with add/edit/remove functionality Supports items (id -> quantity) and currency (id -> amount) entries

Description ​

Usage Example: var editor = DynamicDictionaryEditor.new() editor.setup(dialog_manager, "items", "item") # For items dictionary editor.setup(dialog_manager, "currency", "currency") # For currency dictionary editor.dictionary_changed.connect(_on_inventory_changed)

Variables ​

DialogManagerdialog_manager
Stringdictionary_key"items"
Stringdatabase_type"item"
Stringentry_name_singular"Item"
Stringentry_name_plural"Items"
Dictionarycurrent_dictionary{}
HBoxContainerheader_row
Labelheader_label
Buttonadd_button
VBoxContainerentries_container
Labelempty_label

Methods ​

voidsetup( p_dialog_manager: DialogManager, p_dictionary_key: String = "items", p_database_type: String = "item" )
voidload_dictionary( dictionary: Dictionary )
Dictionaryget_dictionary()
boolis_valid()
Array[String]get_validation_errors()

Signals ​

dictionary_changed( new_dictionary: Dictionary ) ​

Variable descriptions ​

DialogManager dialog_manager ​

========== CONFIGURATION ==========

String dictionary_key = "items" ​

"items" or "currency"

String database_type = "item" ​

"item" or "currency"

String entry_name_singular = "Item" ​

"Item" or "Currency"

String entry_name_plural = "Items" ​

"Items" or "Currencies"

Dictionary current_dictionary = ​

========== STATE ==========

HBoxContainer header_row ​

========== UI COMPONENTS ==========

Label header_label ​

No description yet.

Button add_button ​

No description yet.

VBoxContainer entries_container ​

No description yet.

Label empty_label ​

No description yet.

Method descriptions ​

void setup( p_dialog_manager: DialogManager, p_dictionary_key: String = "items", p_database_type: String = "item" ) ​

No description yet.

void load_dictionary( dictionary: Dictionary ) ​

========== PUBLIC API ==========

Dictionary get_dictionary() ​

No description yet.

bool is_valid() ​

========== VALIDATION ==========

Array[String] get_validation_errors() ​

No description yet.