mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-21 11:43:48 +00:00
Added navigation to main menu options
This commit is contained in:
parent
f7037fa043
commit
316880cf9d
6 changed files with 54 additions and 8 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://c84shrj84g4t2"]
|
[gd_scene load_steps=10 format=3 uid="uid://c84shrj84g4t2"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c06tspxwnj7pg" path="res://Scripts/UI/MusicRoom.cs" id="1_u3ui8"]
|
[ext_resource type="Script" uid="uid://c06tspxwnj7pg" path="res://Scripts/UI/MusicRoom.cs" id="1_u3ui8"]
|
||||||
[ext_resource type="Script" uid="uid://cx63lvsuj1787" path="res://Scripts/Resources/MusicResource.cs" id="2_kybwj"]
|
|
||||||
[ext_resource type="Theme" uid="uid://dnsadvmunm76k" path="res://Resources/Styles/MainMenuButtons.tres" id="2_rcbhv"]
|
[ext_resource type="Theme" uid="uid://dnsadvmunm76k" path="res://Resources/Styles/MainMenuButtons.tres" id="2_rcbhv"]
|
||||||
[ext_resource type="Resource" uid="uid://byo74ews118nl" path="res://Resources/Music/No_Reason.tres" id="3_nkbmj"]
|
[ext_resource type="Resource" uid="uid://byo74ews118nl" path="res://Resources/Music/No_Reason.tres" id="3_nkbmj"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bpd4ldfmt3s51" path="res://Sprites/UI/Note.png" id="3_u3ui8"]
|
[ext_resource type="Texture2D" uid="uid://bpd4ldfmt3s51" path="res://Sprites/UI/Note.png" id="3_u3ui8"]
|
||||||
|
|
@ -16,7 +15,7 @@ font_size = 20
|
||||||
outline_size = 4
|
outline_size = 4
|
||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="MusicRoom" type="VBoxContainer" node_paths=PackedStringArray("TracksContainer", "DescriptionLabel")]
|
[node name="MusicRoom" type="VBoxContainer" node_paths=PackedStringArray("TracksContainer", "DescriptionLabel", "DefaultSelectedButton")]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
|
@ -25,10 +24,11 @@ grow_vertical = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
script = ExtResource("1_u3ui8")
|
script = ExtResource("1_u3ui8")
|
||||||
Tracks = Array[ExtResource("2_kybwj")]([ExtResource("3_nkbmj"), ExtResource("4_cv0ke")])
|
Tracks = [ExtResource("3_nkbmj"), ExtResource("4_cv0ke")]
|
||||||
TracksContainer = NodePath("VBoxContainer/ItemList")
|
TracksContainer = NodePath("VBoxContainer/ItemList")
|
||||||
Icon = ExtResource("3_u3ui8")
|
Icon = ExtResource("3_u3ui8")
|
||||||
DescriptionLabel = NodePath("VBoxContainer/MarginContainer/DescriptionLabel")
|
DescriptionLabel = NodePath("VBoxContainer/MarginContainer/DescriptionLabel")
|
||||||
|
DefaultSelectedButton = NodePath("VBoxContainer/HBoxContainer/BackButton")
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
[ext_resource type="Resource" uid="uid://d1lc8lhq1b05p" path="res://Resources/Debug/DebugLevels.tres" id="3_cvgqx"]
|
[ext_resource type="Resource" uid="uid://d1lc8lhq1b05p" path="res://Resources/Debug/DebugLevels.tres" id="3_cvgqx"]
|
||||||
[ext_resource type="Texture2D" uid="uid://d1a0nwd4wdph7" path="res://Sprites/UI/Back_Small.png" id="5_1xl3a"]
|
[ext_resource type="Texture2D" uid="uid://d1a0nwd4wdph7" path="res://Sprites/UI/Back_Small.png" id="5_1xl3a"]
|
||||||
|
|
||||||
[node name="DebugMenu" type="VBoxContainer" node_paths=PackedStringArray("ButtonsContainer")]
|
[node name="DebugMenu" type="VBoxContainer" node_paths=PackedStringArray("ButtonsContainer", "DefaultSelectedButton")]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
|
@ -17,6 +17,7 @@ script = ExtResource("1_5vtnj")
|
||||||
ButtonTheme = ExtResource("2_6il8q")
|
ButtonTheme = ExtResource("2_6il8q")
|
||||||
Levels = ExtResource("3_cvgqx")
|
Levels = ExtResource("3_cvgqx")
|
||||||
ButtonsContainer = NodePath("ScrollContainer/Level Select")
|
ButtonsContainer = NodePath("ScrollContainer/Level Select")
|
||||||
|
DefaultSelectedButton = NodePath("ScrollContainer/Level Select/BackButton")
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,12 @@ font_size = 12
|
||||||
outline_size = 4
|
outline_size = 4
|
||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="MainMenu" type="CanvasLayer" node_paths=PackedStringArray("SubMenuHolder", "MusicPlayer")]
|
[node name="MainMenu" type="CanvasLayer" node_paths=PackedStringArray("SubMenuHolder", "DefaultSelectedButton", "MusicPlayer")]
|
||||||
script = ExtResource("1_702nk")
|
script = ExtResource("1_702nk")
|
||||||
GameScene = "res://Scenes/Maps/Tutorial.tscn"
|
GameScene = "res://Scenes/Maps/Tutorial.tscn"
|
||||||
MainMenuScene = "res://Scenes/MainMenu.tscn"
|
MainMenuScene = "res://Scenes/MainMenu.tscn"
|
||||||
SubMenuHolder = NodePath("SubMenuContainer")
|
SubMenuHolder = NodePath("SubMenuContainer")
|
||||||
|
DefaultSelectedButton = NodePath("MarginContainer/GridContainer/GameButtons/StartButton")
|
||||||
MusicPlayer = NodePath("AudioStreamPlayer2D")
|
MusicPlayer = NodePath("AudioStreamPlayer2D")
|
||||||
MusicRoomTemplate = ExtResource("2_if7li")
|
MusicRoomTemplate = ExtResource("2_if7li")
|
||||||
DebugMenuTemplate = ExtResource("9_nwlsr")
|
DebugMenuTemplate = ExtResource("9_nwlsr")
|
||||||
|
|
@ -70,23 +71,43 @@ size_flags_vertical = 6
|
||||||
|
|
||||||
[node name="StartButton" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
[node name="StartButton" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
focus_neighbor_left = NodePath("../../Options/OptionsButton")
|
||||||
|
focus_neighbor_top = NodePath("../ExitButton")
|
||||||
|
focus_neighbor_right = NodePath("../../Options/OptionsButton")
|
||||||
|
focus_neighbor_bottom = NodePath("../ContinueButton")
|
||||||
|
focus_next = NodePath("../ContinueButton")
|
||||||
|
focus_previous = NodePath("../ExitButton")
|
||||||
theme = ExtResource("4_nk7wn")
|
theme = ExtResource("4_nk7wn")
|
||||||
text = "New
|
text = "New
|
||||||
Game"
|
Game"
|
||||||
|
|
||||||
[node name="DebugButton2" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
[node name="ContinueButton" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
focus_neighbor_left = NodePath("../../Options/MusicRoomButton")
|
||||||
|
focus_neighbor_top = NodePath("../StartButton")
|
||||||
|
focus_neighbor_right = NodePath("../../Options/MusicRoomButton")
|
||||||
|
focus_neighbor_bottom = NodePath("../DebugButton")
|
||||||
|
focus_next = NodePath("../DebugButton")
|
||||||
|
focus_previous = NodePath("../StartButton")
|
||||||
theme = ExtResource("4_nk7wn")
|
theme = ExtResource("4_nk7wn")
|
||||||
theme_override_styles/normal = ExtResource("7_rrcx7")
|
theme_override_styles/normal = ExtResource("7_rrcx7")
|
||||||
text = "Continue"
|
text = "Continue"
|
||||||
|
|
||||||
[node name="DebugButton" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
[node name="DebugButton" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
focus_neighbor_left = NodePath("../../Options/CreditsButton")
|
||||||
|
focus_neighbor_top = NodePath("../ContinueButton")
|
||||||
|
focus_neighbor_right = NodePath("../../Options/CreditsButton")
|
||||||
|
focus_neighbor_bottom = NodePath("../ExitButton")
|
||||||
theme = ExtResource("4_nk7wn")
|
theme = ExtResource("4_nk7wn")
|
||||||
text = "Debug"
|
text = "Debug"
|
||||||
|
|
||||||
[node name="ExitButton" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
[node name="ExitButton" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
focus_neighbor_left = NodePath("../../Options/CreditsButton")
|
||||||
|
focus_neighbor_top = NodePath("../DebugButton")
|
||||||
|
focus_neighbor_right = NodePath("../../Options/CreditsButton")
|
||||||
|
focus_neighbor_bottom = NodePath("../StartButton")
|
||||||
theme = ExtResource("4_nk7wn")
|
theme = ExtResource("4_nk7wn")
|
||||||
text = "Exit
|
text = "Exit
|
||||||
"
|
"
|
||||||
|
|
@ -130,17 +151,26 @@ size_flags_vertical = 6
|
||||||
|
|
||||||
[node name="OptionsButton" type="Button" parent="MarginContainer/GridContainer/Options"]
|
[node name="OptionsButton" type="Button" parent="MarginContainer/GridContainer/Options"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
focus_neighbor_left = NodePath("../../GameButtons/StartButton")
|
||||||
|
focus_neighbor_top = NodePath("../CreditsButton")
|
||||||
|
focus_neighbor_right = NodePath("../../GameButtons/StartButton")
|
||||||
|
focus_neighbor_bottom = NodePath("../MusicRoomButton")
|
||||||
theme = ExtResource("4_nk7wn")
|
theme = ExtResource("4_nk7wn")
|
||||||
text = "Options"
|
text = "Options"
|
||||||
|
|
||||||
[node name="MusicRoomButton" type="Button" parent="MarginContainer/GridContainer/Options"]
|
[node name="MusicRoomButton" type="Button" parent="MarginContainer/GridContainer/Options"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
focus_neighbor_left = NodePath("../../GameButtons/ContinueButton")
|
||||||
|
focus_neighbor_top = NodePath("../OptionsButton")
|
||||||
|
focus_neighbor_right = NodePath("../../GameButtons/ContinueButton")
|
||||||
|
focus_neighbor_bottom = NodePath("../CreditsButton")
|
||||||
theme = ExtResource("4_nk7wn")
|
theme = ExtResource("4_nk7wn")
|
||||||
text = "Music
|
text = "Music
|
||||||
Room"
|
Room"
|
||||||
|
|
||||||
[node name="CreditsButton" type="Button" parent="MarginContainer/GridContainer/Options"]
|
[node name="CreditsButton" type="Button" parent="MarginContainer/GridContainer/Options"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
focus_neighbor_right = NodePath("../../GameButtons/DebugButton")
|
||||||
theme = ExtResource("4_nk7wn")
|
theme = ExtResource("4_nk7wn")
|
||||||
text = "Credits"
|
text = "Credits"
|
||||||
|
|
||||||
|
|
@ -158,7 +188,7 @@ offset_bottom = 156.0
|
||||||
theme_override_styles/panel = ExtResource("7_rrcx7")
|
theme_override_styles/panel = ExtResource("7_rrcx7")
|
||||||
|
|
||||||
[connection signal="pressed" from="MarginContainer/GridContainer/GameButtons/StartButton" to="." method="_on_start_button_pressed"]
|
[connection signal="pressed" from="MarginContainer/GridContainer/GameButtons/StartButton" to="." method="_on_start_button_pressed"]
|
||||||
[connection signal="pressed" from="MarginContainer/GridContainer/GameButtons/DebugButton2" to="." method="_on_debug_button_pressed"]
|
[connection signal="pressed" from="MarginContainer/GridContainer/GameButtons/ContinueButton" to="." method="_on_debug_button_pressed"]
|
||||||
[connection signal="pressed" from="MarginContainer/GridContainer/GameButtons/DebugButton" to="." method="_on_debug_button_pressed"]
|
[connection signal="pressed" from="MarginContainer/GridContainer/GameButtons/DebugButton" to="." method="_on_debug_button_pressed"]
|
||||||
[connection signal="pressed" from="MarginContainer/GridContainer/GameButtons/ExitButton" to="." method="_on_exit_button_pressed"]
|
[connection signal="pressed" from="MarginContainer/GridContainer/GameButtons/ExitButton" to="." method="_on_exit_button_pressed"]
|
||||||
[connection signal="pressed" from="MarginContainer/GridContainer/Options/OptionsButton" to="." method="OnOptionsButtonPressed"]
|
[connection signal="pressed" from="MarginContainer/GridContainer/Options/OptionsButton" to="." method="OnOptionsButtonPressed"]
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ public partial class MainMenu : CanvasLayer
|
||||||
[Export]
|
[Export]
|
||||||
public Control SubMenuHolder { get; set; } = new Control();
|
public Control SubMenuHolder { get; set; } = new Control();
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Button DefaultSelectedButton { get; private set; }
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public AudioStreamPlayer2D MusicPlayer { get; private set; }
|
public AudioStreamPlayer2D MusicPlayer { get; private set; }
|
||||||
|
|
||||||
|
|
@ -36,6 +39,7 @@ public partial class MainMenu : CanvasLayer
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
DefaultSelectedButton.GrabFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
|
@ -103,6 +107,8 @@ public partial class MainMenu : CanvasLayer
|
||||||
{
|
{
|
||||||
MusicPlayer.Play();
|
MusicPlayer.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefaultSelectedButton.GrabFocus();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,14 @@ public partial class DebugMenu : MenuBase
|
||||||
[Export]
|
[Export]
|
||||||
public Container ButtonsContainer { get; private set; }
|
public Container ButtonsContainer { get; private set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Button DefaultSelectedButton { get; private set; }
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
DefaultSelectedButton.GrabFocus();
|
||||||
|
|
||||||
foreach (var level in Levels.Maps)
|
foreach (var level in Levels.Maps)
|
||||||
{
|
{
|
||||||
if (!level.Enabled) continue;
|
if (!level.Enabled) continue;
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,14 @@ public partial class MusicRoom : MenuBase
|
||||||
[Export]
|
[Export]
|
||||||
public Label DescriptionLabel { get; private set; }
|
public Label DescriptionLabel { get; private set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Button DefaultSelectedButton { get; private set; }
|
||||||
|
|
||||||
private Dictionary<long, AudioNameVisualizer> _tracks = new();
|
private Dictionary<long, AudioNameVisualizer> _tracks = new();
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
DefaultSelectedButton.GrabFocus();
|
||||||
DescriptionLabel.Text = string.Empty;
|
DescriptionLabel.Text = string.Empty;
|
||||||
TracksContainer.Clear();
|
TracksContainer.Clear();
|
||||||
foreach (var track in Tracks)
|
foreach (var track in Tracks)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue