Skip to content

Commit

Permalink
Reworked multi elements
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkVelez committed Aug 14, 2024
1 parent 51ab323 commit 58aefdb
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 259 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[gd_scene load_steps=3 format=3 uid="uid://vlmvkci3ptii"]

[sub_resource type="GDScript" id="GDScript_sk6j2"]
resource_name = "option_element_template"
script/source = "extends OptionElement


# Provide the options for the element
func _init() -> void:
OPTION_LIST_ = {
\"None\": null,
\"Slider\": null,
\"Toggle\": null
}


# Called to apply the setting to the game
func apply_settings() -> void:
pass
"

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]

[node name="MainElement" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_sk6j2")
DEFAULT_VALUE = "None"
OptionsRef = NodePath("Options")
IDENTIFIER = "MainElement"

[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Option Element"
vertical_alignment = 1

[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[gd_scene load_steps=5 format=3 uid="uid://csr6kawyf3t3i"]

[ext_resource type="PackedScene" uid="uid://vlmvkci3ptii" path="res://addons/modular-settings-menu/scenes/settings-elements/templates/multi-element-template/main_element.tscn" id="1_mhqaj"]
[ext_resource type="PackedScene" uid="uid://bjcuw6amean2" path="res://addons/modular-settings-menu/scenes/settings-elements/templates/slider_element_template.tscn" id="2_mf8gn"]
[ext_resource type="PackedScene" uid="uid://cxaxyqer0af21" path="res://addons/modular-settings-menu/scenes/settings-elements/templates/toggle_element_template.tscn" id="3_gs1f8"]

[sub_resource type="GDScript" id="GDScript_sk6j2"]
resource_name = "multi_element_template"
script/source = "extends MultiElement


func display_sub_elements() -> void:
match currentValue:
\"None\":
for element in SUB_ELEMENTS_:
element.hide()
\"Slider\":
SUB_ELEMENTS_[0].show()
SUB_ELEMENTS_[1].hide()
\"Toggle\":
SUB_ELEMENTS_[0].hide()
SUB_ELEMENTS_[1].show()
"

[node name="MultiElementTemplate" type="VBoxContainer" node_paths=PackedStringArray("MainElementRef", "SUB_ELEMENTS_")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
script = SubResource("GDScript_sk6j2")
MainElementRef = NodePath("MainElement")
SUB_ELEMENTS_ = [NodePath("SliderElementTemplate"), NodePath("ToggleElementTemplate")]

[node name="MainElement" parent="." instance=ExtResource("1_mhqaj")]
layout_mode = 2

[node name="SliderElementTemplate" parent="." instance=ExtResource("2_mf8gn")]
layout_mode = 2

[node name="ToggleElementTemplate" parent="." instance=ExtResource("3_gs1f8")]
layout_mode = 2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func _init() -> void:


# Called to apply the setting to the game
func apply_settings() -> void:
func _apply_settings() -> void:
pass
"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ script/source = "extends SliderElement


# Called to apply the setting to the game
func apply_settings() -> void:
func _apply_settings() -> void:
pass
"

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ script/source = "extends ToggleElement


# Called to apply the setting to the game
func apply_settings() -> void:
func _apply_settings() -> void:
pass
"

Expand Down
Loading

0 comments on commit 58aefdb

Please sign in to comment.