started working on this like 2 weeks ago
then stuff happened and now I forgot what I was doing 👍
130 lines
3.6 KiB
Text
130 lines
3.6 KiB
Text
[gd_scene load_steps=8 format=3 uid="uid://tasbgr10p84c"]
|
|
|
|
[ext_resource type="AudioStream" uid="uid://bnbf1nfaxuagi" path="res://sounds/select.ogg" id="1_y8e4h"]
|
|
[ext_resource type="AudioStream" uid="uid://bq3tw55s0ud55" path="res://sounds/confirm.ogg" id="2_hl3ms"]
|
|
|
|
[sub_resource type="GDScript" id="GDScript_18a3y"]
|
|
script/source = "extends MarginContainer
|
|
|
|
signal disabled
|
|
|
|
func add(node: Control, return_button: bool):
|
|
var add_to := $VSplitContainer/MarginContainer/ColorRect
|
|
var children := add_to.get_children(true)
|
|
for child in children:
|
|
child.queue_free()
|
|
|
|
var regex := RegEx.new()
|
|
regex.compile(\"([A-Z])\")
|
|
var menu_name := regex.sub(node.name, \" $1\", true, 1)
|
|
$VSplitContainer/Label.text = menu_name
|
|
add_to.add_child(node)
|
|
$VSplitContainer/AnimationPlayer.play(\"split_offset\")
|
|
|
|
if return_button:
|
|
var button = Button.new()
|
|
button.text = \"Return\"
|
|
button.anchor_top = 1.0
|
|
button.anchor_bottom = 1.0
|
|
button.grow_vertical = Control.GROW_DIRECTION_BEGIN
|
|
button.connect(\"pressed\", disable)
|
|
node.add_child(button)
|
|
|
|
link_to_sounds(node)
|
|
|
|
func link_to_sounds(node: Control):
|
|
var buttons := node.find_children(\"*\", \"Button\", true, false)
|
|
for button in buttons as Array[Button]:
|
|
button.mouse_entered.connect(func(): $Select.play())
|
|
button.pressed.connect(func(): $Confirm.play())
|
|
|
|
func disable():
|
|
$VSplitContainer/AnimationPlayer.play_backwards(\"split_offset\")
|
|
disabled.emit()
|
|
"
|
|
|
|
[sub_resource type="Animation" id="Animation_y8e4h"]
|
|
length = 0.001
|
|
tracks/0/type = "value"
|
|
tracks/0/imported = false
|
|
tracks/0/enabled = true
|
|
tracks/0/path = NodePath(".:split_offset")
|
|
tracks/0/interp = 1
|
|
tracks/0/loop_wrap = true
|
|
tracks/0/keys = {
|
|
"times": PackedFloat32Array(0),
|
|
"transitions": PackedFloat32Array(1),
|
|
"update": 1,
|
|
"values": [500]
|
|
}
|
|
|
|
[sub_resource type="Animation" id="Animation_85u52"]
|
|
resource_name = "split_offset"
|
|
length = 0.5
|
|
step = 0.5
|
|
tracks/0/type = "value"
|
|
tracks/0/imported = false
|
|
tracks/0/enabled = true
|
|
tracks/0/path = NodePath(".:split_offset")
|
|
tracks/0/interp = 1
|
|
tracks/0/loop_wrap = true
|
|
tracks/0/keys = {
|
|
"times": PackedFloat32Array(0, 0.5),
|
|
"transitions": PackedFloat32Array(1, 1),
|
|
"update": 0,
|
|
"values": [500, 0]
|
|
}
|
|
|
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hl3ms"]
|
|
_data = {
|
|
&"RESET": SubResource("Animation_y8e4h"),
|
|
&"split_offset": SubResource("Animation_85u52")
|
|
}
|
|
|
|
[sub_resource type="LabelSettings" id="LabelSettings_2d4ws"]
|
|
font_size = 48
|
|
|
|
[node name="Menu" type="MarginContainer"]
|
|
anchors_preset = 15
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
theme_override_constants/margin_left = 20
|
|
theme_override_constants/margin_top = 20
|
|
theme_override_constants/margin_right = 20
|
|
theme_override_constants/margin_bottom = 20
|
|
script = SubResource("GDScript_18a3y")
|
|
|
|
[node name="VSplitContainer" type="VSplitContainer" parent="."]
|
|
layout_mode = 2
|
|
split_offset = 500
|
|
dragger_visibility = 1
|
|
|
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="VSplitContainer"]
|
|
libraries = {
|
|
&"": SubResource("AnimationLibrary_hl3ms")
|
|
}
|
|
|
|
[node name="Label" type="Label" parent="VSplitContainer"]
|
|
layout_mode = 2
|
|
text = "MENU NAME"
|
|
label_settings = SubResource("LabelSettings_2d4ws")
|
|
horizontal_alignment = 1
|
|
uppercase = true
|
|
|
|
[node name="MarginContainer" type="MarginContainer" parent="VSplitContainer"]
|
|
layout_mode = 2
|
|
theme_override_constants/margin_top = 20
|
|
|
|
[node name="ColorRect" type="ColorRect" parent="VSplitContainer/MarginContainer"]
|
|
layout_mode = 2
|
|
color = Color(0, 0, 0, 1)
|
|
|
|
[node name="Select" type="AudioStreamPlayer" parent="."]
|
|
stream = ExtResource("1_y8e4h")
|
|
bus = &"Sounds"
|
|
|
|
[node name="Confirm" type="AudioStreamPlayer" parent="."]
|
|
stream = ExtResource("2_hl3ms")
|
|
bus = &"Sounds"
|