cambios
This commit is contained in:
42
game/ui/menus/main_menu/main_menu.gd
Normal file
42
game/ui/menus/main_menu/main_menu.gd
Normal file
@@ -0,0 +1,42 @@
|
||||
# A simple main menu
|
||||
extends Control
|
||||
|
||||
|
||||
# Start the game
|
||||
func _on_new_game_pressed():
|
||||
escoria.new_game()
|
||||
|
||||
|
||||
# Show the load slots
|
||||
func _on_load_game_pressed():
|
||||
$main.hide()
|
||||
$load_game.refresh_savegames()
|
||||
$load_game.show()
|
||||
|
||||
|
||||
# Show the options panel
|
||||
func _on_options_pressed():
|
||||
$main.hide()
|
||||
$options.show()
|
||||
|
||||
|
||||
# Quit the game
|
||||
func _on_quit_pressed():
|
||||
escoria.quit()
|
||||
|
||||
|
||||
# Hide the options panel again
|
||||
func _on_options_back_button_pressed():
|
||||
reset()
|
||||
|
||||
|
||||
# Hide the load panel
|
||||
func _on_load_game_back_button_pressed():
|
||||
reset()
|
||||
|
||||
|
||||
# Resets the UI to initial state
|
||||
func reset():
|
||||
$load_game.hide()
|
||||
$options.hide()
|
||||
$main.show()
|
||||
104
game/ui/menus/main_menu/main_menu.tscn
Normal file
104
game/ui/menus/main_menu/main_menu.tscn
Normal file
@@ -0,0 +1,104 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/main_menu/main_menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://gymkhana-logo.png" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/options/options.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/load/load_game.tscn" type="PackedScene" id=5]
|
||||
|
||||
[sub_resource type="ImageTexture" id=1]
|
||||
|
||||
[node name="main_menu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="load_game" parent="." instance=ExtResource( 5 )]
|
||||
visible = false
|
||||
|
||||
[node name="options" parent="." instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
|
||||
[node name="main" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="Panel" type="Panel" parent="main"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_editor_description_": ""
|
||||
}
|
||||
|
||||
[node name="main" type="VBoxContainer" parent="main"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -313.0
|
||||
margin_top = -2.0
|
||||
margin_right = 303.0
|
||||
margin_bottom = -2.0
|
||||
custom_constants/separation = 100
|
||||
alignment = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="main/main"]
|
||||
margin_top = 280.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 280.0
|
||||
texture = SubResource( 1 )
|
||||
|
||||
[node name="Gymkhana-logo" type="Sprite" parent="main/main/TextureRect"]
|
||||
position = Vector2( 301, -47 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="buttons" type="VBoxContainer" parent="main/main"]
|
||||
margin_top = 380.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 620.0
|
||||
custom_constants/separation = 10
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="new_game" type="Button" parent="main/main/buttons"]
|
||||
margin_right = 616.0
|
||||
margin_bottom = 150.0
|
||||
rect_min_size = Vector2( 0, 150 )
|
||||
size_flags_vertical = 3
|
||||
text = "NEW_GAME"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="load_game" type="Button" parent="main/main/buttons"]
|
||||
margin_top = 160.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 180.0
|
||||
text = "LOAD_GAME"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="options" type="Button" parent="main/main/buttons"]
|
||||
margin_top = 190.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 210.0
|
||||
text = "OPTIONS"
|
||||
|
||||
[node name="quit" type="Button" parent="main/main/buttons"]
|
||||
margin_top = 220.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 240.0
|
||||
text = "QUIT"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="back_button_pressed" from="load_game" to="." method="_on_load_game_back_button_pressed"]
|
||||
[connection signal="back_button_pressed" from="options" to="." method="_on_options_back_button_pressed"]
|
||||
[connection signal="pressed" from="main/main/buttons/new_game" to="." method="_on_new_game_pressed"]
|
||||
[connection signal="pressed" from="main/main/buttons/load_game" to="." method="_on_load_game_pressed"]
|
||||
[connection signal="pressed" from="main/main/buttons/options" to="." method="_on_options_pressed"]
|
||||
[connection signal="pressed" from="main/main/buttons/quit" to="." method="_on_quit_pressed"]
|
||||
Reference in New Issue
Block a user