cambios
This commit is contained in:
68
game/ui/menus/pause_menu/pause_menu.gd
Normal file
68
game/ui/menus/pause_menu/pause_menu.gd
Normal file
@@ -0,0 +1,68 @@
|
||||
# A menu shown in game
|
||||
extends Control
|
||||
|
||||
|
||||
# Make the pause menu process in pause mode and hide it just to be sure
|
||||
func _ready():
|
||||
self.pause_mode = Node.PAUSE_MODE_PROCESS
|
||||
hide()
|
||||
|
||||
|
||||
# Continue the game
|
||||
func _on_continue_pressed():
|
||||
escoria.main.current_scene.game.unpause_game()
|
||||
|
||||
|
||||
# Show the save slots
|
||||
func _on_save_game_pressed():
|
||||
$VBoxContainer.hide()
|
||||
$save_game.show()
|
||||
|
||||
|
||||
# Show the load slots
|
||||
func _on_load_game_pressed():
|
||||
$VBoxContainer.hide()
|
||||
$load_game.refresh_savegames()
|
||||
$load_game.show()
|
||||
|
||||
|
||||
# Show the options menu
|
||||
func _on_options_pressed():
|
||||
$VBoxContainer.hide()
|
||||
$options.show()
|
||||
|
||||
|
||||
# Quit the game
|
||||
func _on_quit_pressed():
|
||||
escoria.quit()
|
||||
|
||||
|
||||
# Hide the save slots after clicking back button
|
||||
func _on_save_game_back_button_pressed():
|
||||
reset()
|
||||
|
||||
|
||||
# Hide the load slots after clicking back button
|
||||
func _on_load_game_back_button_pressed():
|
||||
reset()
|
||||
|
||||
|
||||
# Hide options menu after clicking back button
|
||||
func _on_options_back_button_pressed():
|
||||
reset()
|
||||
|
||||
|
||||
# Set whether saving is enabled currently
|
||||
#
|
||||
# #### Parameters
|
||||
# - p_enabled: Enable or disable saving
|
||||
func set_save_enabled(p_enabled: bool):
|
||||
$VBoxContainer/menuitems/save_game.disabled = !p_enabled
|
||||
|
||||
|
||||
# Resets the UI to initial state
|
||||
func reset():
|
||||
$save_game.hide()
|
||||
$load_game.hide()
|
||||
$options.hide()
|
||||
$VBoxContainer.show()
|
||||
115
game/ui/menus/pause_menu/pause_menu.tscn
Normal file
115
game/ui/menus/pause_menu/pause_menu.tscn
Normal file
@@ -0,0 +1,115 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/pause_menu/pause_menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/options/options.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/escoria-core/design/escoria-logo-small.png" type="Texture" id=3]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/save/save_game.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]
|
||||
|
||||
[node name="pause_menu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="save_game" parent="." instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
|
||||
[node name="load_game" parent="." instance=ExtResource( 5 )]
|
||||
visible = false
|
||||
|
||||
[node name="options" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -308.0
|
||||
margin_right = 308.0
|
||||
custom_constants/separation = 100
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer"]
|
||||
margin_top = 147.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 383.0
|
||||
texture = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="menuitems" type="VBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 483.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 753.0
|
||||
custom_constants/separation = 10
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="continue" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_right = 616.0
|
||||
margin_bottom = 150.0
|
||||
rect_min_size = Vector2( 0, 150 )
|
||||
size_flags_vertical = 3
|
||||
text = "CONTINUE_GAME"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="save_game" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_top = 160.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 180.0
|
||||
size_flags_vertical = 3
|
||||
text = "SAVE_GAME"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="load_game" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_top = 190.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 210.0
|
||||
size_flags_vertical = 3
|
||||
text = "LOAD_GAME"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="options" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_top = 220.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 240.0
|
||||
text = "OPTIONS"
|
||||
|
||||
[node name="quit" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_top = 250.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 270.0
|
||||
size_flags_vertical = 3
|
||||
text = "QUIT"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="back_button_pressed" from="save_game" to="." method="_on_save_game_back_button_pressed"]
|
||||
[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="VBoxContainer/menuitems/continue" to="." method="_on_continue_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/save_game" to="." method="_on_save_game_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/load_game" to="." method="_on_load_game_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/options" to="." method="_on_options_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/quit" to="." method="_on_quit_pressed"]
|
||||
Reference in New Issue
Block a user