Menus organized in dirs

This commit is contained in:
2025-12-18 11:41:26 +03:00
parent d55047239a
commit 1943c11b1c
29 changed files with 20 additions and 20 deletions
+21
View File
@@ -0,0 +1,21 @@
extends Control
signal show_main_menu
@onready var main_menu_button : Button = $%MainMenuButton
@onready var button_focus_timer : Timer = $ButtonFocusTimer
func _on_timer_timeout() -> void:
main_menu_button.grab_focus()
func _on_main_menu_button_pressed() -> void:
show_main_menu.emit()
func _on_visibility_changed() -> void:
if visible and button_focus_timer:
button_focus_timer.start()
+1
View File
@@ -0,0 +1 @@
uid://bkj8s7588e1ho
+45
View File
@@ -0,0 +1,45 @@
[gd_scene load_steps=3 format=3 uid="uid://duxm8n62j2qt6"]
[ext_resource type="Script" uid="uid://bkj8s7588e1ho" path="res://menu/ingame/game_over_screen.gd" id="1_rkkr6"]
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://images/menu_button.tres" id="2_uh3ar"]
[node name="GameOverScreen" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_rkkr6")
[node name="CenterContainer" type="CenterContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="CenterContainer/VBoxContainer"]
z_index = 100
layout_mode = 2
text = "Game Over"
horizontal_alignment = 1
[node name="MainMenuButton" type="Button" parent="CenterContainer/VBoxContainer"]
unique_name_in_owner = true
z_index = 100
layout_mode = 2
mouse_filter = 2
theme = ExtResource("2_uh3ar")
text = "Main Menu"
[node name="ButtonFocusTimer" type="Timer" parent="."]
one_shot = true
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
[connection signal="timeout" from="ButtonFocusTimer" to="." method="_on_timer_timeout"]
+44
View File
@@ -0,0 +1,44 @@
extends Control
signal continue_game
signal show_main_menu
signal show_options
@onready var continue_button := $%ContinueButton
@onready var main_menu_button := $%MainMenuButton
func _ready() -> void:
_init_focus()
_setup_neighbors()
func _on_visibility_changed() -> void:
if not is_node_ready(): return
if not visible: return
_init_focus()
_setup_neighbors()
func _init_focus() -> void:
continue_button.grab_focus()
func _setup_neighbors() -> void:
continue_button.focus_neighbor_top = main_menu_button.get_path()
main_menu_button.focus_neighbor_bottom = continue_button.get_path()
func _on_continue_button_pressed() -> void:
continue_game.emit()
func _on_options_button_pressed() -> void:
show_options.emit()
func _on_main_menu_button_pressed() -> void:
show_main_menu.emit()
+1
View File
@@ -0,0 +1 @@
uid://npqs2m5g5bd6
+49
View File
@@ -0,0 +1,49 @@
[gd_scene load_steps=4 format=3 uid="uid://bclo2wl8ibrcg"]
[ext_resource type="Script" uid="uid://npqs2m5g5bd6" path="res://menu/ingame/pause_menu.gd" id="1_inj1j"]
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://images/menu_button.tres" id="2_vy7sn"]
[sub_resource type="Shortcut" id="Shortcut_lgp46"]
[node name="PauseMenu" type="Control"]
process_mode = 2
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_inj1j")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
top_level = true
layout_mode = 0
offset_left = 100.0
offset_top = 100.0
offset_right = 196.0
offset_bottom = 166.0
[node name="ContinueButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
z_index = 100
layout_mode = 2
mouse_filter = 2
theme = ExtResource("2_vy7sn")
shortcut = SubResource("Shortcut_lgp46")
text = "CONTINUE"
[node name="OptionsButton" type="Button" parent="VBoxContainer"]
z_index = 100
layout_mode = 2
mouse_filter = 2
theme = ExtResource("2_vy7sn")
text = "OPTIONS"
[node name="MainMenuButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
z_index = 100
layout_mode = 2
mouse_filter = 2
theme = ExtResource("2_vy7sn")
text = "MAIN MENU"
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="pressed" from="VBoxContainer/ContinueButton" to="." method="_on_continue_button_pressed"]
[connection signal="pressed" from="VBoxContainer/OptionsButton" to="." method="_on_options_button_pressed"]
[connection signal="pressed" from="VBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
+56
View File
@@ -0,0 +1,56 @@
extends Control
signal continue_game
signal show_main_menu
@onready var pause_menu : Control = $PauseMenu
@onready var options : Control = $Options
@onready var credits : Control = $Credits
func _ready() -> void:
_show_menu(pause_menu)
func _input(event: InputEvent) -> void:
if event.is_action_pressed("pause") or event.is_action_pressed("ui_cancel"):
_on_pause_menu_continue_game.call_deferred()
func _show_menu(menu: Control) -> void:
var menus : Array[Control] = [ pause_menu, options, credits ]
for m in menus:
m.hide()
menu.show()
func _on_pause_menu_continue_game() -> void:
continue_game.emit()
func _on_pause_menu_show_main_menu() -> void:
show_main_menu.emit()
func _on_pause_menu_show_options() -> void:
_show_menu(options)
func _on_options_back() -> void:
_show_menu(pause_menu)
func _on_options_show_credits() -> void:
_show_menu(credits)
func _on_credits_back() -> void:
_show_menu(options)
func _on_visibility_changed() -> void:
get_tree().paused = visible
+1
View File
@@ -0,0 +1 @@
uid://c5d2t2o53wkmt
+28
View File
@@ -0,0 +1,28 @@
[gd_scene load_steps=5 format=3 uid="uid://d34nh3lc1gpb"]
[ext_resource type="Script" uid="uid://c5d2t2o53wkmt" path="res://menu/ingame/pause_screen.gd" id="1_fe1q8"]
[ext_resource type="PackedScene" uid="uid://bclo2wl8ibrcg" path="res://menu/ingame/pause_menu.tscn" id="2_4r6ly"]
[ext_resource type="PackedScene" uid="uid://btr60idiit4y7" path="res://menu/common/options.tscn" id="3_3gwb3"]
[ext_resource type="PackedScene" uid="uid://c3q3g2647qc27" path="res://menu/common/credits.tscn" id="4_jph5s"]
[node name="PauseScreen" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_fe1q8")
[node name="PauseMenu" parent="." instance=ExtResource("2_4r6ly")]
layout_mode = 0
[node name="Options" parent="." instance=ExtResource("3_3gwb3")]
layout_mode = 0
[node name="Credits" parent="." instance=ExtResource("4_jph5s")]
layout_mode = 0
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="continue_game" from="PauseMenu" to="." method="_on_pause_menu_continue_game"]
[connection signal="show_main_menu" from="PauseMenu" to="." method="_on_pause_menu_show_main_menu"]
[connection signal="show_options" from="PauseMenu" to="." method="_on_pause_menu_show_options"]
[connection signal="back" from="Options" to="." method="_on_options_back"]
[connection signal="show_credits" from="Options" to="." method="_on_options_show_credits"]
[connection signal="back" from="Credits" to="." method="_on_credits_back"]
+21
View File
@@ -0,0 +1,21 @@
extends Control
signal show_main_menu
@onready var main_menu_button : Button = $%MainMenuButton
@onready var button_focus_timer : Timer = $ButtonFocusTimer
func _on_timer_timeout() -> void:
main_menu_button.grab_focus()
func _on_main_menu_button_pressed() -> void:
show_main_menu.emit()
func _on_visibility_changed() -> void:
if visible and button_focus_timer:
button_focus_timer.start()
+1
View File
@@ -0,0 +1 @@
uid://b0p1ewlw18ijg
+45
View File
@@ -0,0 +1,45 @@
[gd_scene load_steps=3 format=3 uid="uid://bdcs2ff85qjs4"]
[ext_resource type="Script" uid="uid://b0p1ewlw18ijg" path="res://menu/ingame/victory_screen.gd" id="1_asigk"]
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://images/menu_button.tres" id="2_wb4d8"]
[node name="VictoryScreen" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_asigk")
[node name="CenterContainer" type="CenterContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="CenterContainer/VBoxContainer"]
z_index = 100
layout_mode = 2
text = "Victory!"
horizontal_alignment = 1
[node name="MainMenuButton" type="Button" parent="CenterContainer/VBoxContainer"]
unique_name_in_owner = true
z_index = 100
layout_mode = 2
mouse_filter = 2
theme = ExtResource("2_wb4d8")
text = "Main Menu"
[node name="ButtonFocusTimer" type="Timer" parent="."]
one_shot = true
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
[connection signal="timeout" from="ButtonFocusTimer" to="." method="_on_timer_timeout"]