Files
MaidEngine/scenes/main_menu.tscn
2026-04-02 08:29:24 -04:00

96 lines
2.9 KiB
Plaintext

[gd_scene format=3 uid="uid://dlbuo46n6q238"]
[ext_resource type="Theme" uid="uid://dx26d6py3n8xi" path="res://resources/main_ui_theme.tres" id="1_ekxnf"]
[ext_resource type="AudioStream" uid="uid://b7dgmblbcm0cj" path="res://assets/music/menu_theme.OGG" id="1_yqeox"]
[sub_resource type="GDScript" id="GDScript_bqqt6"]
resource_name = "StartButton"
script/source = "extends Button
const COMBAT_SCENE = preload(\"res://scenes/strategy_phase.tscn\")
const UNIT_SCENE = preload(\"res://prefabs/unit.tscn\")
const PLAYER_ALLEGIANCE = preload(\"res://resources/allegiance_types/player_allegiance.tres\")
const ENEMY_ALLEGIANCE = preload(\"res://resources/allegiance_types/enemy_allegiance.tres\")
const MAP_LAYOUT := \"\"\"\\
#####
#...#
#...#
#...#
#####\"\"\"
func _pressed() -> void:
var combat_instance := COMBAT_SCENE.instantiate()
var combat_map: CombatMap = combat_instance.find_child(\"CombatMap\")
combat_map.load_map(MAP_LAYOUT)
var player_unit: Unit = UNIT_SCENE.instantiate()
player_unit.stat_template = UnitStats.new(50)
player_unit.info_template = UnitInfo.new()
player_unit.info_template.name = \"Putit\"
player_unit.allegiance_template = PLAYER_ALLEGIANCE
combat_map.deploy_unit(player_unit, Vector2i(2, 2))
var enemy_unit: Unit = UNIT_SCENE.instantiate()
enemy_unit.stat_template = UnitStats.new(50)
enemy_unit.info_template = UnitInfo.new()
enemy_unit.info_template.name = \"Putit\"
enemy_unit.allegiance_template = ENEMY_ALLEGIANCE
combat_map.deploy_unit(enemy_unit, Vector2i(2, 1))
var tree := get_tree()
var root := tree.root
var current_scene := tree.current_scene
root.remove_child(current_scene)
current_scene.queue_free()
root.add_child(combat_instance)
tree.current_scene = combat_instance
"
[sub_resource type="GDScript" id="GDScript_ekxnf"]
resource_name = "ExitButton"
script/source = "extends Button
func _pressed() -> void:
get_tree().quit(0)
"
[node name="Menu" type="Control" unique_id=528000941]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_ekxnf")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="." unique_id=1976575731]
stream = ExtResource("1_yqeox")
autoplay = true
[node name="Buttons" type="VBoxContainer" parent="." unique_id=1869378860]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
alignment = 1
[node name="StartButton" type="Button" parent="Buttons" unique_id=734401781]
layout_mode = 2
text = "Start"
script = SubResource("GDScript_bqqt6")
[node name="Options" type="Button" parent="Buttons" unique_id=1037030570]
layout_mode = 2
text = "Options"
[node name="ExitButton" type="Button" parent="Buttons" unique_id=1205095617]
layout_mode = 2
text = "Exit"
script = SubResource("GDScript_ekxnf")
[connection signal="pressed" from="Buttons/Options" to="Buttons/Options" method="_on_pressed"]