Added menu settings add-on

This commit is contained in:
2026-03-07 14:16:44 +01:00
parent 8b7a8e014f
commit df8c8c6c3b
70 changed files with 4053 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
extends Button
class_name ButtonElement
## Reference to the element's panel scene.
@export var ElementPanelScene: PackedScene
## Reference to the node the settings element is under.
@onready var ParentRef: Node = owner
## Reference to the element's panel.
var ElementPanelRef: Node
func _ready():
# Connect necessary signals
connect("pressed", pressed)
create_element_panel()
func pressed() -> void:
# Switch panels
ParentRef.SettingsMenuRef.SettingsPanelRef.hide()
ElementPanelRef.show()
# Populate the settings cache of the panel
ElementPanelRef.get_settings()
## Called to create the element's panel.
func create_element_panel() -> void:
var ElementPanelsRef: Control = ParentRef.SettingsMenuRef.ElementPanelsRef
ElementPanelRef = ElementPanelScene.instantiate()
# Check if the element panel exists
if not ElementPanelsRef.find_child(ElementPanelRef.name):
# Give a reference of the element
ElementPanelRef.PanelOwnerRef = self
ElementPanelRef.hide()
# Add the panel to the element panels list
ElementPanelsRef.add_child(ElementPanelRef)
ElementPanelRef.set_owner(ParentRef.SettingsMenuRef)