DreamBall/menus/menu.tscn
Taevas eefda9e2bd start creating the framework for menus (#3)
all very experimental so it'll see lots of changes
2025-03-27 16:00:39 +01:00

99 lines
2.7 KiB
Text

[gd_scene load_steps=6 format=3 uid="uid://tasbgr10p84c"]
[sub_resource type="GDScript" id="GDScript_18a3y"]
script/source = "extends MarginContainer
func add(node: Control):
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\")
#await get_tree().create_timer(3.0).timeout
#$VSplitContainer/AnimationPlayer.play_backwards(\"split_offset\")
"
[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)