Basic game template addon
This commit is contained in:
26
menus/scenes/windows/game_won_window.gd
Normal file
26
menus/scenes/windows/game_won_window.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
@tool
|
||||
extends OverlaidWindow
|
||||
|
||||
signal continue_pressed
|
||||
signal main_menu_pressed
|
||||
|
||||
func _ready():
|
||||
if OS.has_feature("web"):
|
||||
%ExitButton.hide()
|
||||
|
||||
func _on_exit_button_pressed():
|
||||
%ExitConfirmation.show()
|
||||
|
||||
func _on_main_menu_button_pressed():
|
||||
%MainMenuConfirmation.show()
|
||||
|
||||
func _on_close_button_pressed():
|
||||
continue_pressed.emit()
|
||||
close()
|
||||
|
||||
func _on_main_menu_confirmation_confirmed():
|
||||
main_menu_pressed.emit()
|
||||
close()
|
||||
|
||||
func _on_exit_confirmation_confirmed():
|
||||
get_tree().quit()
|
||||
1
menus/scenes/windows/game_won_window.gd.uid
Normal file
1
menus/scenes/windows/game_won_window.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cwab7rbiob2ca
|
||||
60
menus/scenes/windows/game_won_window.tscn
Normal file
60
menus/scenes/windows/game_won_window.tscn
Normal file
@@ -0,0 +1,60 @@
|
||||
[gd_scene format=3 uid="uid://bivbf27ymoluy"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window.tscn" id="1_h0vmg"]
|
||||
[ext_resource type="Script" path="res://menus/scenes/windows/game_won_window.gd" id="2_a248v"]
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/confirmation_overlaid_window.tscn" id="3_dgrgs"]
|
||||
|
||||
[node name="GameWonWindow" instance=ExtResource("1_h0vmg")]
|
||||
custom_minimum_size = Vector2(432, 240)
|
||||
script = ExtResource("2_a248v")
|
||||
update_content = true
|
||||
text = "You won!"
|
||||
close_button_text = "Continue"
|
||||
title_visible = false
|
||||
|
||||
[node name="TitleMargin" parent="ContentContainer/BoxContainer" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="DescriptionLabel" parent="ContentContainer/BoxContainer/BodyMargin" index="0"]
|
||||
text = "You won!"
|
||||
|
||||
[node name="MenuButtons" parent="ContentContainer/BoxContainer/MenuButtonsMargin" index="0"]
|
||||
vertical = false
|
||||
|
||||
[node name="ExitButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="0"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Exit"
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="1"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="CloseButton" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="2"]
|
||||
size_flags_horizontal = 3
|
||||
text = "Continue"
|
||||
|
||||
[node name="MainMenuConfirmation" parent="." index="1" instance=ExtResource("3_dgrgs")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(220, 0)
|
||||
layout_mode = 2
|
||||
text = "Exit to the main menu?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[node name="ExitConfirmation" parent="." index="2" instance=ExtResource("3_dgrgs")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Exit the game?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/ExitButton" to="." method="_on_exit_button_pressed"]
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
[connection signal="confirmed" from="MainMenuConfirmation" to="." method="_on_main_menu_confirmation_confirmed"]
|
||||
[connection signal="confirmed" from="ExitConfirmation" to="." method="_on_exit_confirmation_confirmed"]
|
||||
26
menus/scenes/windows/level_lost_window.gd
Normal file
26
menus/scenes/windows/level_lost_window.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
@tool
|
||||
extends OverlaidWindow
|
||||
|
||||
signal restart_pressed
|
||||
signal main_menu_pressed
|
||||
|
||||
func _ready():
|
||||
if OS.has_feature("web"):
|
||||
%ExitButton.hide()
|
||||
|
||||
func _on_exit_button_pressed():
|
||||
%ExitConfirmation.show()
|
||||
|
||||
func _on_main_menu_button_pressed():
|
||||
%MainMenuConfirmation.show()
|
||||
|
||||
func _on_close_button_pressed():
|
||||
restart_pressed.emit()
|
||||
close()
|
||||
|
||||
func _on_main_menu_confirmation_confirmed():
|
||||
main_menu_pressed.emit()
|
||||
close()
|
||||
|
||||
func _on_exit_confirmation_confirmed():
|
||||
get_tree().quit()
|
||||
1
menus/scenes/windows/level_lost_window.gd.uid
Normal file
1
menus/scenes/windows/level_lost_window.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bbffpw7vyygic
|
||||
58
menus/scenes/windows/level_lost_window.tscn
Normal file
58
menus/scenes/windows/level_lost_window.tscn
Normal file
@@ -0,0 +1,58 @@
|
||||
[gd_scene format=3 uid="uid://bimlvpibjpem0"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window.tscn" id="1_k3yu0"]
|
||||
[ext_resource type="Script" path="res://menus/scenes/windows/level_lost_window.gd" id="2_u8wtw"]
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/confirmation_overlaid_window.tscn" id="3_pir6e"]
|
||||
|
||||
[node name="LevelLostWindow" instance=ExtResource("1_k3yu0")]
|
||||
custom_minimum_size = Vector2(432, 240)
|
||||
script = ExtResource("2_u8wtw")
|
||||
update_content = true
|
||||
text = "You lost..."
|
||||
close_button_text = "Restart"
|
||||
title_visible = false
|
||||
|
||||
[node name="TitleMargin" parent="ContentContainer/BoxContainer" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="DescriptionLabel" parent="ContentContainer/BoxContainer/BodyMargin" index="0"]
|
||||
text = "You lost..."
|
||||
|
||||
[node name="MenuButtons" parent="ContentContainer/BoxContainer/MenuButtonsMargin" index="0"]
|
||||
vertical = false
|
||||
|
||||
[node name="ExitButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="0"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Exit"
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="1"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="CloseButton" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="2"]
|
||||
size_flags_horizontal = 3
|
||||
text = "Restart"
|
||||
|
||||
[node name="MainMenuConfirmation" parent="." index="1" instance=ExtResource("3_pir6e")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(220, 0)
|
||||
layout_mode = 2
|
||||
text = "Exit to the main menu?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[node name="ExitConfirmation" parent="." index="2" instance=ExtResource("3_pir6e")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Exit the game?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/ExitButton" to="." method="_on_exit_button_pressed"]
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
[connection signal="confirmed" from="MainMenuConfirmation" to="." method="_on_main_menu_confirmation_confirmed"]
|
||||
[connection signal="confirmed" from="ExitConfirmation" to="." method="_on_exit_confirmation_confirmed"]
|
||||
31
menus/scenes/windows/level_won_window.gd
Normal file
31
menus/scenes/windows/level_won_window.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
@tool
|
||||
extends OverlaidWindow
|
||||
|
||||
signal continue_pressed
|
||||
signal main_menu_pressed
|
||||
signal restart_pressed
|
||||
|
||||
func _ready():
|
||||
if OS.has_feature("web"):
|
||||
%ExitButton.hide()
|
||||
|
||||
func _on_exit_button_pressed():
|
||||
%ExitConfirmation.show()
|
||||
|
||||
func _on_main_menu_button_pressed():
|
||||
%MainMenuConfirmation.show()
|
||||
|
||||
func _on_close_button_pressed():
|
||||
continue_pressed.emit()
|
||||
close()
|
||||
|
||||
func _on_main_menu_confirmation_confirmed():
|
||||
main_menu_pressed.emit()
|
||||
close()
|
||||
|
||||
func _on_restart_button_pressed():
|
||||
restart_pressed.emit()
|
||||
close()
|
||||
|
||||
func _on_exit_confirmation_confirmed():
|
||||
get_tree().quit()
|
||||
1
menus/scenes/windows/level_won_window.gd.uid
Normal file
1
menus/scenes/windows/level_won_window.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://uuspingcbajg
|
||||
66
menus/scenes/windows/level_won_window.tscn
Normal file
66
menus/scenes/windows/level_won_window.tscn
Normal file
@@ -0,0 +1,66 @@
|
||||
[gd_scene format=3 uid="uid://q2oum0xhreo8"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window.tscn" id="1_wtikh"]
|
||||
[ext_resource type="Script" path="res://menus/scenes/windows/level_won_window.gd" id="2_tsvun"]
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/confirmation_overlaid_window.tscn" id="3_kw6pv"]
|
||||
|
||||
[node name="LevelWonWindow" instance=ExtResource("1_wtikh")]
|
||||
custom_minimum_size = Vector2(432, 240)
|
||||
script = ExtResource("2_tsvun")
|
||||
update_content = true
|
||||
text = "Level complete!"
|
||||
close_button_text = "Continue"
|
||||
title_visible = false
|
||||
|
||||
[node name="TitleMargin" parent="ContentContainer/BoxContainer" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="DescriptionLabel" parent="ContentContainer/BoxContainer/BodyMargin" index="0"]
|
||||
text = "Level complete!"
|
||||
|
||||
[node name="MenuButtons" parent="ContentContainer/BoxContainer/MenuButtonsMargin" index="0"]
|
||||
vertical = false
|
||||
|
||||
[node name="ExitButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="0"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Exit"
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="1"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="RestartButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Restart"
|
||||
|
||||
[node name="CloseButton" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="3"]
|
||||
size_flags_horizontal = 3
|
||||
text = "Continue"
|
||||
|
||||
[node name="MainMenuConfirmation" parent="." index="1" instance=ExtResource("3_kw6pv")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(220, 0)
|
||||
layout_mode = 2
|
||||
text = "Exit to the main menu?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[node name="ExitConfirmation" parent="." index="2" instance=ExtResource("3_kw6pv")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Exit the game?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/ExitButton" to="." method="_on_exit_button_pressed"]
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/RestartButton" to="." method="_on_restart_button_pressed"]
|
||||
[connection signal="confirmed" from="MainMenuConfirmation" to="." method="_on_main_menu_confirmation_confirmed"]
|
||||
[connection signal="confirmed" from="ExitConfirmation" to="." method="_on_exit_confirmation_confirmed"]
|
||||
7
menus/scenes/windows/main_menu_credits_window.gd
Normal file
7
menus/scenes/windows/main_menu_credits_window.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
@tool
|
||||
extends "res://addons/maaacks_game_template/base/nodes/windows/overlaid_window_scene_container.gd"
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
if instance and instance.has_signal(&"end_reached"):
|
||||
instance.connect(&"end_reached", close)
|
||||
1
menus/scenes/windows/main_menu_credits_window.gd.uid
Normal file
1
menus/scenes/windows/main_menu_credits_window.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c1apsdpynl7ex
|
||||
25
menus/scenes/windows/main_menu_credits_window.tscn
Normal file
25
menus/scenes/windows/main_menu_credits_window.tscn
Normal file
@@ -0,0 +1,25 @@
|
||||
[gd_scene format=3 uid="uid://cvweffl7bo7bj"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window_scene_container.tscn" id="1_nuhlj"]
|
||||
[ext_resource type="Script" path="res://menus/scenes/windows/main_menu_credits_window.gd" id="2_o2qx8"]
|
||||
[ext_resource type="PackedScene" path="res://menus/scenes/credits/scrollable_credits.tscn" id="3_h2dw7"]
|
||||
|
||||
[node name="MainMenuCreditsOverlaidWindow" instance=ExtResource("1_nuhlj")]
|
||||
anchors_preset = 15
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 0.0
|
||||
offset_top = 0.0
|
||||
offset_right = 0.0
|
||||
offset_bottom = 0.0
|
||||
script = ExtResource("2_o2qx8")
|
||||
packed_scene = ExtResource("3_h2dw7")
|
||||
|
||||
[node name="TitleMargin" parent="ContentContainer/BoxContainer" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="CloseButton" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="0"]
|
||||
size_flags_horizontal = 0
|
||||
text = "Back"
|
||||
28
menus/scenes/windows/main_menu_options_window.tscn
Normal file
28
menus/scenes/windows/main_menu_options_window.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[gd_scene format=3 uid="uid://xkqu58vkydps"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window_scene_container.tscn" id="1_nkqug"]
|
||||
[ext_resource type="PackedScene" path="res://menus/scenes/menus/options_menu/master_options_menu_with_tabs.tscn" id="2_ldm64"]
|
||||
|
||||
[node name="MainMenuOptionsOverlaidWindow" instance=ExtResource("1_nkqug")]
|
||||
anchors_preset = 15
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 0.0
|
||||
offset_top = 0.0
|
||||
offset_right = 0.0
|
||||
offset_bottom = 0.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
packed_scene = ExtResource("2_ldm64")
|
||||
update_content = true
|
||||
close_button_text = "Back"
|
||||
title_visible = false
|
||||
|
||||
[node name="TitleMargin" parent="ContentContainer/BoxContainer" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="CloseButton" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="0"]
|
||||
size_flags_horizontal = 0
|
||||
text = "Back"
|
||||
119
menus/scenes/windows/pause_menu.gd
Normal file
119
menus/scenes/windows/pause_menu.gd
Normal file
@@ -0,0 +1,119 @@
|
||||
@tool
|
||||
extends OverlaidWindow
|
||||
|
||||
@export var options_menu_scene : PackedScene
|
||||
## Path to a main menu scene.
|
||||
@export_file("*.tscn") var main_menu_scene_path : String
|
||||
@export_node_path(&"ConfirmationOverlaidWindow") var restart_confirmation_node_path : NodePath
|
||||
@export_node_path(&"ConfirmationOverlaidWindow") var main_menu_confirmation_node_path : NodePath
|
||||
@export_node_path(&"ConfirmationOverlaidWindow") var exit_confirmation_node_path : NodePath
|
||||
@export var menu_container_node_path : NodePath = ^".."
|
||||
|
||||
@onready var restart_confirmation : ConfirmationOverlaidWindow = get_node(restart_confirmation_node_path)
|
||||
@onready var main_menu_confirmation : ConfirmationOverlaidWindow = get_node(main_menu_confirmation_node_path)
|
||||
@onready var exit_confirmation : ConfirmationOverlaidWindow = get_node(exit_confirmation_node_path)
|
||||
@onready var menu_container : Node = get_node(menu_container_node_path)
|
||||
@onready var options_button = %OptionsButton
|
||||
@onready var main_menu_button = %MainMenuButton
|
||||
@onready var exit_button = %ExitButton
|
||||
## If Maaack's Scene Loader is installed, then it will be used to change scenes.
|
||||
@onready var scene_loader_node = get_tree().root.get_node_or_null(^"SceneLoader")
|
||||
|
||||
var open_window : Node
|
||||
var _ignore_first_cancel : bool = false
|
||||
|
||||
func get_main_menu_scene_path() -> String:
|
||||
return main_menu_scene_path
|
||||
|
||||
func close_window() -> void:
|
||||
if open_window != null:
|
||||
if open_window.has_method("close"):
|
||||
open_window.close()
|
||||
else:
|
||||
open_window.hide()
|
||||
open_window = null
|
||||
|
||||
func _disable_focus() -> void:
|
||||
for child in %MenuButtons.get_children():
|
||||
if child is Control:
|
||||
child.focus_mode = FOCUS_NONE
|
||||
|
||||
func _enable_focus() -> void:
|
||||
for child in %MenuButtons.get_children():
|
||||
if child is Control:
|
||||
child.focus_mode = FOCUS_ALL
|
||||
|
||||
func _load_scene(scene_path: String) -> void:
|
||||
_scene_tree.paused = false
|
||||
if scene_loader_node:
|
||||
scene_loader_node.load_scene(scene_path)
|
||||
else:
|
||||
get_tree().change_scene_to_file(scene_path)
|
||||
|
||||
func _show_window(window : Control) -> void:
|
||||
_disable_focus.call_deferred()
|
||||
window.show()
|
||||
open_window = window
|
||||
await window.hidden
|
||||
open_window = null
|
||||
_enable_focus.call_deferred()
|
||||
|
||||
func _load_and_show_menu(scene : PackedScene) -> void:
|
||||
var window_instance : Control = scene.instantiate()
|
||||
window_instance.visible = false
|
||||
menu_container.add_child.call_deferred(window_instance)
|
||||
await _show_window(window_instance)
|
||||
window_instance.queue_free()
|
||||
|
||||
func _handle_cancel_input() -> void:
|
||||
if _ignore_first_cancel:
|
||||
_ignore_first_cancel = false
|
||||
return
|
||||
if open_window != null:
|
||||
close_window()
|
||||
else:
|
||||
super._handle_cancel_input()
|
||||
|
||||
func show() -> void:
|
||||
super.show()
|
||||
if Input.is_action_pressed("ui_cancel"):
|
||||
_ignore_first_cancel = true
|
||||
|
||||
func _refresh_exit_button() -> void:
|
||||
exit_button.visible = !OS.has_feature("web")
|
||||
|
||||
func _refresh_options_button() -> void:
|
||||
options_button.visible = options_menu_scene != null
|
||||
|
||||
func _refresh_main_menu_button() -> void:
|
||||
main_menu_button.visible = !get_main_menu_scene_path().is_empty()
|
||||
|
||||
func _ready() -> void:
|
||||
_refresh_exit_button()
|
||||
_refresh_options_button()
|
||||
_refresh_main_menu_button()
|
||||
restart_confirmation.confirmed.connect(_on_restart_confirmation_confirmed)
|
||||
main_menu_confirmation.confirmed.connect(_on_main_menu_confirmation_confirmed)
|
||||
exit_confirmation.confirmed.connect(_on_exit_confirmation_confirmed)
|
||||
|
||||
func _on_restart_button_pressed() -> void:
|
||||
_show_window(restart_confirmation)
|
||||
|
||||
func _on_options_button_pressed() -> void:
|
||||
_load_and_show_menu(options_menu_scene)
|
||||
|
||||
func _on_main_menu_button_pressed() -> void:
|
||||
_show_window(main_menu_confirmation)
|
||||
|
||||
func _on_exit_button_pressed() -> void:
|
||||
_show_window(exit_confirmation)
|
||||
|
||||
func _on_restart_confirmation_confirmed() -> void:
|
||||
get_tree().reload_current_scene()
|
||||
close()
|
||||
|
||||
func _on_main_menu_confirmation_confirmed():
|
||||
_load_scene(get_main_menu_scene_path())
|
||||
|
||||
func _on_exit_confirmation_confirmed():
|
||||
get_tree().quit()
|
||||
1
menus/scenes/windows/pause_menu.gd.uid
Normal file
1
menus/scenes/windows/pause_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bgajacd4x5y5c
|
||||
82
menus/scenes/windows/pause_menu.tscn
Normal file
82
menus/scenes/windows/pause_menu.tscn
Normal file
@@ -0,0 +1,82 @@
|
||||
[gd_scene format=3 uid="uid://docl4rn3h2wf8"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window.tscn" id="1_lqur3"]
|
||||
[ext_resource type="Script" path="res://menus/scenes/windows/pause_menu.gd" id="2_h3gat"]
|
||||
[ext_resource type="PackedScene" path="res://menus/scenes/windows/pause_menu_options_window.tscn" id="3_qnib3"]
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/confirmation_overlaid_window.tscn" id="4_25tgp"]
|
||||
|
||||
[node name="PauseMenu" instance=ExtResource("1_lqur3")]
|
||||
process_mode = 3
|
||||
custom_minimum_size = Vector2(256, 312)
|
||||
offset_left = -128.0
|
||||
offset_top = -155.0
|
||||
offset_right = 128.0
|
||||
offset_bottom = 157.0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
script = ExtResource("2_h3gat")
|
||||
options_menu_scene = ExtResource("3_qnib3")
|
||||
main_menu_scene_path = "res://menus/scenes/menus/main_menu/main_menu_with_animations.tscn"
|
||||
restart_confirmation_node_path = NodePath("RestartConfirmation")
|
||||
main_menu_confirmation_node_path = NodePath("MainMenuConfirmation")
|
||||
exit_confirmation_node_path = NodePath("ExitConfirmation")
|
||||
menu_container_node_path = NodePath("..")
|
||||
pauses_game = true
|
||||
|
||||
[node name="TitleLabel" parent="ContentContainer/BoxContainer/TitleMargin/BoxContainer" index="0"]
|
||||
text = "Paused"
|
||||
|
||||
[node name="BodyMargin" parent="ContentContainer/BoxContainer" index="1"]
|
||||
visible = false
|
||||
|
||||
[node name="MenuButtonsMargin" parent="ContentContainer/BoxContainer" index="2"]
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="CloseButton" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="0"]
|
||||
text = "Resume"
|
||||
|
||||
[node name="RestartButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="1"]
|
||||
layout_mode = 2
|
||||
text = "Restart"
|
||||
|
||||
[node name="OptionsButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Options"
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="3"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="ExitButton" type="Button" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="4"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Exit Game"
|
||||
|
||||
[node name="RestartConfirmation" parent="." index="1" instance=ExtResource("4_25tgp")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Restart the game?"
|
||||
title = "Confirm Restart"
|
||||
|
||||
[node name="MainMenuConfirmation" parent="." index="2" instance=ExtResource("4_25tgp")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(220, 0)
|
||||
layout_mode = 2
|
||||
text = "Exit to the main menu?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[node name="ExitConfirmation" parent="." index="3" instance=ExtResource("4_25tgp")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Exit the game?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/RestartButton" to="." method="_on_restart_button_pressed"]
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/OptionsButton" to="." method="_on_options_button_pressed"]
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
[connection signal="pressed" from="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/ExitButton" to="." method="_on_exit_button_pressed"]
|
||||
13
menus/scenes/windows/pause_menu_layer.gd
Normal file
13
menus/scenes/windows/pause_menu_layer.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends CanvasLayer
|
||||
|
||||
@onready var pause_menu = %PauseMenu
|
||||
|
||||
func _on_pause_menu_hidden():
|
||||
hide()
|
||||
|
||||
func _on_visibility_changed():
|
||||
if visible:
|
||||
pause_menu.show()
|
||||
|
||||
func _ready():
|
||||
visibility_changed.connect(_on_visibility_changed)
|
||||
1
menus/scenes/windows/pause_menu_layer.gd.uid
Normal file
1
menus/scenes/windows/pause_menu_layer.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bo7kdymgdhkdm
|
||||
98
menus/scenes/windows/pause_menu_layer.tscn
Normal file
98
menus/scenes/windows/pause_menu_layer.tscn
Normal file
@@ -0,0 +1,98 @@
|
||||
[gd_scene format=3 uid="uid://w2f00usvsami"]
|
||||
|
||||
[ext_resource type="Script" path="res://menus/scenes/windows/pause_menu_layer.gd" id="1_c8aok"]
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window.tscn" id="2_a2qjc"]
|
||||
[ext_resource type="Script" path="res://menus/scenes/windows/pause_menu.gd" id="3_xji41"]
|
||||
[ext_resource type="PackedScene" path="res://menus/scenes/windows/pause_menu_options_window.tscn" id="4_tf3kx"]
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/confirmation_overlaid_window.tscn" id="5_rhdwm"]
|
||||
|
||||
[node name="PauseMenuLayer" type="CanvasLayer"]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_c8aok")
|
||||
|
||||
[node name="PauseMenu" parent="." instance=ExtResource("2_a2qjc")]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
custom_minimum_size = Vector2(256, 312)
|
||||
script = ExtResource("3_xji41")
|
||||
options_menu_scene = ExtResource("4_tf3kx")
|
||||
main_menu_scene_path = "res://menus/scenes/menus/main_menu/main_menu_with_animations.tscn"
|
||||
restart_confirmation_node_path = NodePath("../RestartConfirmation")
|
||||
main_menu_confirmation_node_path = NodePath("../MainMenuConfirmation")
|
||||
exit_confirmation_node_path = NodePath("../ExitConfirmation")
|
||||
menu_container_node_path = NodePath("..")
|
||||
pauses_game = true
|
||||
update_content = true
|
||||
title = "Paused"
|
||||
|
||||
[node name="TitleLabel" parent="PauseMenu/ContentContainer/BoxContainer/TitleMargin/BoxContainer" index="0"]
|
||||
text = "Paused"
|
||||
|
||||
[node name="BodyMargin" parent="PauseMenu/ContentContainer/BoxContainer" index="1"]
|
||||
visible = false
|
||||
|
||||
[node name="MenuButtonsMargin" parent="PauseMenu/ContentContainer/BoxContainer" index="2"]
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="CloseButton" parent="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="0"]
|
||||
text = "Resume"
|
||||
|
||||
[node name="RestartButton" type="Button" parent="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="1"]
|
||||
layout_mode = 2
|
||||
text = "Restart"
|
||||
|
||||
[node name="SaveGameButton" type="Button" parent="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="2"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Save Game"
|
||||
|
||||
[node name="LoadGameButton" type="Button" parent="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="3"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Load Game"
|
||||
|
||||
[node name="OptionsButton" type="Button" parent="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="4"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Options"
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="5"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="ExitButton" type="Button" parent="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="6"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Exit Game"
|
||||
|
||||
[node name="RestartConfirmation" parent="." instance=ExtResource("5_rhdwm")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
text = "Restart the game?"
|
||||
title = "Confirm Restart"
|
||||
|
||||
[node name="MainMenuConfirmation" parent="." instance=ExtResource("5_rhdwm")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(220, 0)
|
||||
text = "Exit to the main menu?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[node name="ExitConfirmation" parent="." instance=ExtResource("5_rhdwm")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
text = "Exit the game?"
|
||||
title = "Confirm Exit"
|
||||
|
||||
[connection signal="hidden" from="PauseMenu" to="." method="_on_pause_menu_hidden"]
|
||||
[connection signal="pressed" from="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/RestartButton" to="PauseMenu" method="_on_restart_button_pressed"]
|
||||
[connection signal="pressed" from="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/SaveGameButton" to="PauseMenu" method="_on_save_game_button_pressed"]
|
||||
[connection signal="pressed" from="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/LoadGameButton" to="PauseMenu" method="_on_load_game_button_pressed"]
|
||||
[connection signal="pressed" from="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/OptionsButton" to="PauseMenu" method="_on_options_button_pressed"]
|
||||
[connection signal="pressed" from="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/MainMenuButton" to="PauseMenu" method="_on_main_menu_button_pressed"]
|
||||
[connection signal="pressed" from="PauseMenu/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons/ExitButton" to="PauseMenu" method="_on_exit_button_pressed"]
|
||||
|
||||
[editable path="PauseMenu"]
|
||||
28
menus/scenes/windows/pause_menu_options_window.tscn
Normal file
28
menus/scenes/windows/pause_menu_options_window.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[gd_scene format=3 uid="uid://tbhmg0d0ns6i"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window_scene_container.tscn" id="1_fimhq"]
|
||||
[ext_resource type="PackedScene" path="res://menus/scenes/menus/options_menu/master_options_menu_with_tabs.tscn" id="2_j26ns"]
|
||||
|
||||
[node name="PauseMenuOptionsOverlaidWindow" instance=ExtResource("1_fimhq")]
|
||||
process_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 0.0
|
||||
offset_top = 0.0
|
||||
offset_right = 0.0
|
||||
offset_bottom = 0.0
|
||||
packed_scene = ExtResource("2_j26ns")
|
||||
title_visible = false
|
||||
|
||||
[node name="TitleMargin" parent="ContentContainer/BoxContainer" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="TitleLabel" parent="ContentContainer/BoxContainer/TitleMargin/BoxContainer" index="0"]
|
||||
text = "Options"
|
||||
|
||||
[node name="CloseButton" parent="ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="0"]
|
||||
size_flags_horizontal = 0
|
||||
text = "Back"
|
||||
Reference in New Issue
Block a user