Reworked main menu. Fixed projectiles bug
This commit is contained in:
+11
-5
@@ -1,15 +1,21 @@
|
||||
extends Node
|
||||
extends Control
|
||||
|
||||
|
||||
signal show_main_menu
|
||||
signal back
|
||||
|
||||
|
||||
@onready var main_menu_button := $%MainMenuButton
|
||||
@onready var main_menu_button := $%BackButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
main_menu_button.grab_focus()
|
||||
|
||||
|
||||
func _on_main_menu_button_pressed() -> void:
|
||||
show_main_menu.emit()
|
||||
func _on_visibility_changed() -> void:
|
||||
if not is_node_ready(): return
|
||||
if not visible: return
|
||||
|
||||
main_menu_button.grab_focus()
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
back.emit()
|
||||
|
||||
+4
-3
@@ -39,12 +39,13 @@ text = "Ruslan Ignatov"
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
[node name="BackButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("2_nidem")
|
||||
shortcut = SubResource("Shortcut_nidem")
|
||||
text = "Main Menu"
|
||||
text = "Back"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/BackButton" to="." method="_on_back_button_pressed"]
|
||||
|
||||
+9
-1
@@ -1,4 +1,4 @@
|
||||
extends Node
|
||||
extends Control
|
||||
|
||||
|
||||
signal continue_game
|
||||
@@ -17,6 +17,14 @@ func _ready() -> void:
|
||||
_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:
|
||||
if continue_button.disabled:
|
||||
start_button.grab_focus()
|
||||
|
||||
@@ -47,6 +47,7 @@ mouse_filter = 2
|
||||
theme = ExtResource("2_f5okj")
|
||||
text = "QUIT"
|
||||
|
||||
[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/StartButton" to="." method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/OptionsButton" to="." method="_on_options_button_pressed"]
|
||||
|
||||
+12
-3
@@ -1,8 +1,8 @@
|
||||
extends Node
|
||||
extends Control
|
||||
|
||||
|
||||
signal show_credits
|
||||
signal show_main_menu
|
||||
signal back
|
||||
|
||||
|
||||
@onready var fullscreen_button := $%FullscreenCheckButton
|
||||
@@ -15,7 +15,16 @@ func _ready() -> void:
|
||||
_load_current_settings()
|
||||
_init_focus()
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if not is_node_ready(): return
|
||||
if not visible: return
|
||||
|
||||
_load_current_settings()
|
||||
_init_focus()
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _init_focus() -> void:
|
||||
fullscreen_button.grab_focus()
|
||||
@@ -51,4 +60,4 @@ func _on_credits_button_pressed() -> void:
|
||||
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
show_main_menu.emit()
|
||||
back.emit()
|
||||
|
||||
@@ -80,6 +80,7 @@ theme = ExtResource("2_1tdpy")
|
||||
shortcut = SubResource("Shortcut_1tdpy")
|
||||
text = "Back"
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="toggled" from="VBoxContainer/OptionsGridContainer/FullscreenCheckButton" to="." method="_on_fullscreen_check_button_toggled"]
|
||||
[connection signal="item_selected" from="VBoxContainer/OptionsGridContainer/WindowFactorOptionButton" to="." method="_on_window_factor_option_button_item_selected"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/CreditsButton" to="." method="_on_credits_button_pressed"]
|
||||
|
||||
+9
-1
@@ -1,4 +1,4 @@
|
||||
extends Node
|
||||
extends Control
|
||||
|
||||
|
||||
@onready var continue_button := $%ContinueButton
|
||||
@@ -14,6 +14,14 @@ func _ready() -> void:
|
||||
_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()
|
||||
|
||||
|
||||
@@ -41,5 +41,6 @@ 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/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
extends Control
|
||||
|
||||
|
||||
@onready var main_menu : Control = $MainMenu
|
||||
@onready var options : Control = $Options
|
||||
@onready var credits : Control = $Credits
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_show_menu(main_menu)
|
||||
|
||||
|
||||
func _show_menu(menu: Control) -> void:
|
||||
var menus : Array[Control] = [ main_menu, options, credits ]
|
||||
|
||||
for m in menus:
|
||||
m.hide()
|
||||
|
||||
menu.show()
|
||||
|
||||
|
||||
func _on_main_menu_continue_game() -> void:
|
||||
print("continue")
|
||||
|
||||
|
||||
func _on_main_menu_new_game() -> void:
|
||||
get_tree().change_scene_to_file("res://game/game.tscn")
|
||||
|
||||
|
||||
func _on_main_menu_quit_game() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_main_menu_show_options() -> void:
|
||||
_show_menu(options)
|
||||
|
||||
|
||||
func _on_options_show_credits() -> void:
|
||||
_show_menu(credits)
|
||||
|
||||
|
||||
func _on_options_back() -> void:
|
||||
_show_menu(main_menu)
|
||||
|
||||
|
||||
func _on_credits_back() -> void:
|
||||
_show_menu(options)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bqnepsuk13qo8
|
||||
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://2oavbr7oaihg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bqnepsuk13qo8" path="res://menu/title_screen.gd" id="1_lxdol"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxlccevt52y70" path="res://menu/main_menu.tscn" id="2_o0rbc"]
|
||||
[ext_resource type="PackedScene" uid="uid://btr60idiit4y7" path="res://menu/options.tscn" id="3_88gnj"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3q3g2647qc27" path="res://menu/credits.tscn" id="4_w1y3c"]
|
||||
|
||||
[node name="TitleScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_lxdol")
|
||||
|
||||
[node name="MainMenu" parent="." instance=ExtResource("2_o0rbc")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Options" parent="." instance=ExtResource("3_88gnj")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Credits" parent="." instance=ExtResource("4_w1y3c")]
|
||||
layout_mode = 0
|
||||
|
||||
[connection signal="continue_game" from="MainMenu" to="." method="_on_main_menu_continue_game"]
|
||||
[connection signal="new_game" from="MainMenu" to="." method="_on_main_menu_new_game"]
|
||||
[connection signal="quit_game" from="MainMenu" to="." method="_on_main_menu_quit_game"]
|
||||
[connection signal="show_options" from="MainMenu" to="." method="_on_main_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"]
|
||||
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://2oavbr7oaihg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bqnepsuk13qo8" path="res://menu/title_screen.gd" id="1_lxdol"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxlccevt52y70" path="res://menu/main_menu.tscn" id="2_o0rbc"]
|
||||
[ext_resource type="PackedScene" uid="uid://btr60idiit4y7" path="res://menu/options.tscn" id="3_88gnj"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3q3g2647qc27" path="res://menu/credits.tscn" id="4_w1y3c"]
|
||||
|
||||
[node name="TitleScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_lxdol")
|
||||
|
||||
[node name="MainMenu" parent="." instance=ExtResource("2_o0rbc")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Options" parent="." instance=ExtResource("3_88gnj")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Credits" parent="." instance=ExtResource("4_w1y3c")]
|
||||
layout_mode = 0
|
||||
|
||||
[connection signal="continue_game" from="MainMenu" to="." method="_on_main_menu_continue_game"]
|
||||
[connection signal="new_game" from="MainMenu" to="." method="_on_main_menu_new_game"]
|
||||
[connection signal="quit_game" from="MainMenu" to="." method="_on_main_menu_quit_game"]
|
||||
[connection signal="show_options" from="MainMenu" to="." method="_on_main_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"]
|
||||
Reference in New Issue
Block a user