mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 04:45:54 +00:00
Submenus
This commit is contained in:
parent
248d6dc1f0
commit
50950f8284
13 changed files with 170 additions and 45 deletions
BIN
Music/Title.mp3
(Stored with Git LFS)
BIN
Music/Title.mp3
(Stored with Git LFS)
Binary file not shown.
|
|
@ -19,7 +19,7 @@ _name = "Intro"
|
|||
[sub_resource type="Resource" id="Resource_cfhv5"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = []
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_0k62o"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -31,7 +31,7 @@ StartData = SubResource("Resource_cfhv5")
|
|||
[sub_resource type="Resource" id="Resource_tpb7s"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = []
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_edoov"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -43,7 +43,7 @@ StartData = SubResource("Resource_tpb7s")
|
|||
[sub_resource type="Resource" id="Resource_1sw5g"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 255
|
||||
StartingEquipment = []
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_47bot"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -73,7 +73,7 @@ _name = "Rebel Base"
|
|||
[sub_resource type="Resource" id="Resource_maxpt"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = []
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_pein5"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
|
|||
12
Resources/Styles/Title_Text_Style.tres
Normal file
12
Resources/Styles/Title_Text_Style.tres
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://wr7cb2qa6w71"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://ccm3u37q1hvux" path="res://fonts/Xolonium-Regular.ttf" id="1_1ljef"]
|
||||
|
||||
[resource]
|
||||
line_spacing = 0.0
|
||||
font = ExtResource("1_1ljef")
|
||||
font_size = 34
|
||||
outline_size = 8
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
shadow_size = 9
|
||||
shadow_offset = Vector2(16, 16)
|
||||
48
Scenes/HUD/MusicRoom.tscn
Normal file
48
Scenes/HUD/MusicRoom.tscn
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://c84shrj84g4t2"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c06tspxwnj7pg" path="res://Scripts/UI/MusicRoom.cs" id="1_u3ui8"]
|
||||
[ext_resource type="LabelSettings" uid="uid://wr7cb2qa6w71" path="res://Resources/Styles/Title_Text_Style.tres" id="1_w47yj"]
|
||||
[ext_resource type="Theme" uid="uid://dnsadvmunm76k" path="res://Resources/Styles/MainMenuButtons.tres" id="2_rcbhv"]
|
||||
[ext_resource type="Texture2D" uid="uid://bpd4ldfmt3s51" path="res://Sprites/UI/Note.png" id="3_u3ui8"]
|
||||
|
||||
[node name="MusicRoom" type="VBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_u3ui8")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
text = "MUSIC ROOM"
|
||||
label_settings = ExtResource("1_w47yj")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Button" type="Button" parent="HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_rcbhv")
|
||||
text = "Back"
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = ExtResource("2_rcbhv")
|
||||
item_count = 4
|
||||
item_0/text = "Intro"
|
||||
item_0/icon = ExtResource("3_u3ui8")
|
||||
item_1/text = "No Reason"
|
||||
item_1/icon = ExtResource("3_u3ui8")
|
||||
item_2/text = "Level 1"
|
||||
item_2/icon = ExtResource("3_u3ui8")
|
||||
item_3/text = "Rumia"
|
||||
item_3/icon = ExtResource("3_u3ui8")
|
||||
|
|
@ -1,26 +1,19 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://5xajclchk3my"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://5xajclchk3my"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dql102fvubniv" path="res://Scripts/MainMenu.cs" id="1_702nk"]
|
||||
[ext_resource type="PackedScene" uid="uid://c84shrj84g4t2" path="res://Scenes/HUD/MusicRoom.tscn" id="2_if7li"]
|
||||
[ext_resource type="Texture2D" uid="uid://xvadkvwajs0t" path="res://Sprites/UI/Crystal.png" id="2_j4e6a"]
|
||||
[ext_resource type="Texture2D" uid="uid://dicat7qqa0a7o" path="res://Sprites/Portraits/CirnoTitle.png" id="2_mpelb"]
|
||||
[ext_resource type="Texture2D" uid="uid://by38ufb51f6rx" path="res://Sprites/UI/TitleBackground.png" id="2_qdx0s"]
|
||||
[ext_resource type="FontFile" uid="uid://ccm3u37q1hvux" path="res://fonts/Xolonium-Regular.ttf" id="3_bl0se"]
|
||||
[ext_resource type="AudioStream" uid="uid://di416g5wgx6j0" path="res://Music/Title.mp3" id="4_i6ku4"]
|
||||
[ext_resource type="Theme" uid="uid://dnsadvmunm76k" path="res://Resources/Styles/MainMenuButtons.tres" id="4_nk7wn"]
|
||||
[ext_resource type="LabelSettings" uid="uid://wr7cb2qa6w71" path="res://Resources/Styles/Title_Text_Style.tres" id="7_loo7a"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3tyacxxw88lx" path="res://Scenes/Utils/StreamPlayerWithName.tscn" id="8_koqhg"]
|
||||
[ext_resource type="PackedScene" uid="uid://bemu3l6b1e84y" path="res://Scenes/HUD/debug_menu.tscn" id="9_nwlsr"]
|
||||
|
||||
[sub_resource type="Theme" id="Theme_c7h4d"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_fb256"]
|
||||
line_spacing = 0.0
|
||||
font = ExtResource("3_bl0se")
|
||||
font_size = 34
|
||||
outline_size = 8
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
shadow_size = 9
|
||||
shadow_offset = Vector2(16, 16)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_htmja"]
|
||||
line_spacing = 2.0
|
||||
font = ExtResource("3_bl0se")
|
||||
|
|
@ -28,7 +21,10 @@ font_size = 12
|
|||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Control" type="Control" node_paths=PackedStringArray("DebugMenuHolder")]
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_if7li"]
|
||||
bg_color = Color(0, 0, 0, 0.760784)
|
||||
|
||||
[node name="Control" type="Control" node_paths=PackedStringArray("SubMenuHolder")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
|
@ -40,8 +36,9 @@ grow_vertical = 2
|
|||
script = ExtResource("1_702nk")
|
||||
GameScene = "res://Scenes/Maps/Tutorial.tscn"
|
||||
MainMenuScene = "res://Scenes/MainMenu.tscn"
|
||||
SubMenuHolder = NodePath("SubMenuContainer")
|
||||
MusicRoomTemplate = ExtResource("2_if7li")
|
||||
DebugMenuTemplate = ExtResource("9_nwlsr")
|
||||
DebugMenuHolder = NodePath("Panel")
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="."]
|
||||
layout_mode = 0
|
||||
|
|
@ -78,7 +75,13 @@ size_flags_vertical = 6
|
|||
[node name="StartButton" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("4_nk7wn")
|
||||
text = "Start"
|
||||
text = "New
|
||||
Game"
|
||||
|
||||
[node name="DebugButton2" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("4_nk7wn")
|
||||
text = "Continue"
|
||||
|
||||
[node name="DebugButton" type="Button" parent="MarginContainer/GridContainer/GameButtons"]
|
||||
layout_mode = 2
|
||||
|
|
@ -107,7 +110,7 @@ theme = SubResource("Theme_c7h4d")
|
|||
theme_override_fonts/font = ExtResource("3_bl0se")
|
||||
theme_override_font_sizes/font_size = 28
|
||||
text = "CIRNO"
|
||||
label_settings = SubResource("LabelSettings_fb256")
|
||||
label_settings = ExtResource("7_loo7a")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="MarginContainer/GridContainer/Title/VBoxContainer"]
|
||||
|
|
@ -128,25 +131,39 @@ stretch_mode = 2
|
|||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
|
||||
[node name="Button" type="Button" parent="MarginContainer/GridContainer/Options"]
|
||||
[node name="OptionsButton" type="Button" parent="MarginContainer/GridContainer/Options"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("4_nk7wn")
|
||||
text = "Options"
|
||||
|
||||
[node name="MusicRoomButton" type="Button" parent="MarginContainer/GridContainer/Options"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("4_nk7wn")
|
||||
text = "Music
|
||||
Room"
|
||||
|
||||
[node name="CreditsButton" type="Button" parent="MarginContainer/GridContainer/Options"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("4_nk7wn")
|
||||
text = "Credits"
|
||||
|
||||
[node name="AudioStreamPlayer2D" parent="." instance=ExtResource("8_koqhg")]
|
||||
stream = ExtResource("4_i6ku4")
|
||||
autoplay = true
|
||||
TrackName = "Main Menu"
|
||||
TrackName = "No Reason"
|
||||
AuthorName = "Fenekhu"
|
||||
|
||||
[node name="Panel" type="PanelContainer" parent="."]
|
||||
[node name="SubMenuContainer" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 66.0
|
||||
offset_top = 45.0
|
||||
offset_right = 259.0
|
||||
offset_left = 13.0
|
||||
offset_top = 23.0
|
||||
offset_right = 312.0
|
||||
offset_bottom = 156.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_if7li")
|
||||
|
||||
[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/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/Options/MusicRoomButton" to="." method="_on_music_room_button_pressed"]
|
||||
|
|
|
|||
|
|
@ -474,7 +474,7 @@ SpawnMarkers = Dictionary[int, NodePath]({
|
|||
255: NodePath("Factory Tilemaps/Debug Room/DebugRoomStartPosition")
|
||||
})
|
||||
WeaponTemplate = ExtResource("3_2wlhc")
|
||||
StartingEquipment = [ExtResource("4_swym2"), ExtResource("5_nqier")]
|
||||
StartingEquipment = Array[ExtResource("6_8tdlb")]([ExtResource("4_swym2"), ExtResource("5_nqier")])
|
||||
MapStartData = SubResource("Resource_6sau4")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ public partial class Hud : CanvasLayer
|
|||
|
||||
DebugMenuHolder.CallDeferred("add_child", menu);
|
||||
|
||||
menu.DebugMenuClosed += () =>
|
||||
menu.MenuClosed += () =>
|
||||
{
|
||||
DebugMenuHolder.Visible = false;
|
||||
SpawnPauseMenu();
|
||||
|
|
|
|||
|
|
@ -10,13 +10,17 @@ public partial class MainMenu : Control
|
|||
[Export]
|
||||
public string MainMenuScene { get; set; }
|
||||
|
||||
[ExportGroup("Debug Menu")]
|
||||
[Export]
|
||||
public Control SubMenuHolder { get; set; } = new Control();
|
||||
|
||||
[ExportCategory("Music Room")]
|
||||
[Export]
|
||||
public PackedScene MusicRoomTemplate { get; set; }
|
||||
|
||||
[ExportCategory("Debug Menu")]
|
||||
[Export]
|
||||
public PackedScene DebugMenuTemplate { get; set; }
|
||||
|
||||
[ExportGroup("Debug Menu")]
|
||||
[Export]
|
||||
public Control DebugMenuHolder { get; set; }
|
||||
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
|
|
@ -38,22 +42,50 @@ public partial class MainMenu : Control
|
|||
|
||||
private void _on_debug_button_pressed()
|
||||
{
|
||||
if (DebugMenuTemplate is null || DebugMenuHolder is null) return;
|
||||
DebugMenuHolder.Visible = true;
|
||||
SpawnMenu<DebugMenu>(DebugMenuTemplate, SubMenuHolder);
|
||||
|
||||
// if (DebugMenuTemplate is null || DebugMenuHolder is null) return;
|
||||
// DebugMenuHolder.Visible = true;
|
||||
|
||||
var children = DebugMenuHolder.GetChildren();
|
||||
// var children = DebugMenuHolder.GetChildren();
|
||||
// foreach (var child in children)
|
||||
// {
|
||||
// child.QueueFree();
|
||||
// }
|
||||
|
||||
// var menu = DebugMenuTemplate.Instantiate<DebugMenu>();
|
||||
|
||||
// DebugMenuHolder.CallDeferred("add_child", menu);
|
||||
|
||||
// menu.DebugMenuClosed += () =>
|
||||
// {
|
||||
// DebugMenuHolder.Visible = false;
|
||||
// };
|
||||
}
|
||||
|
||||
private void _on_music_room_button_pressed()
|
||||
{
|
||||
SpawnMenu<MusicRoom>(MusicRoomTemplate, SubMenuHolder);
|
||||
}
|
||||
|
||||
private void SpawnMenu<T>(PackedScene template, Control holder) where T : MenuBase
|
||||
{
|
||||
if (template is null || holder is null) return;
|
||||
holder.Visible = true;
|
||||
|
||||
var children = holder.GetChildren();
|
||||
foreach (var child in children)
|
||||
{
|
||||
child.QueueFree();
|
||||
}
|
||||
|
||||
var menu = DebugMenuTemplate.Instantiate<DebugMenu>();
|
||||
var menu = template.Instantiate<T>();
|
||||
|
||||
DebugMenuHolder.CallDeferred("add_child", menu);
|
||||
holder.CallDeferred("add_child", menu);
|
||||
|
||||
menu.DebugMenuClosed += () =>
|
||||
menu.MenuClosed += () =>
|
||||
{
|
||||
DebugMenuHolder.Visible = false;
|
||||
holder.Visible = false;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Cirno.Scripts.Resources.DebugMenu;
|
|||
using Godot.Collections;
|
||||
using DebugMapSelectData = Cirno.Scripts.Resources.DebugMenu.DebugMapSelectData;
|
||||
|
||||
public partial class DebugMenu : Control
|
||||
public partial class DebugMenu : MenuBase
|
||||
{
|
||||
|
||||
[Export]
|
||||
|
|
@ -17,9 +17,6 @@ public partial class DebugMenu : Control
|
|||
[Export]
|
||||
public Container ButtonsContainer { get; private set; }
|
||||
|
||||
[Signal]
|
||||
public delegate void DebugMenuClosedEventHandler();
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -52,7 +49,7 @@ public partial class DebugMenu : Control
|
|||
{
|
||||
this.QueueFree();
|
||||
|
||||
EmitSignal(SignalName.DebugMenuClosed);
|
||||
EmitSignal(SignalName.MenuClosed);
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
|
|
|||
12
Scripts/UI/MenuBase.cs
Normal file
12
Scripts/UI/MenuBase.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
using Godot;
|
||||
using System;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.Resources.DebugMenu;
|
||||
using Godot.Collections;
|
||||
|
||||
public partial class MenuBase : Control
|
||||
{
|
||||
[Signal]
|
||||
public delegate void MenuClosedEventHandler();
|
||||
}
|
||||
1
Scripts/UI/MenuBase.cs.uid
Normal file
1
Scripts/UI/MenuBase.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://jyqs08gi37of
|
||||
5
Scripts/UI/MusicRoom.cs
Normal file
5
Scripts/UI/MusicRoom.cs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
public partial class MusicRoom : MenuBase
|
||||
{
|
||||
|
||||
}
|
||||
1
Scripts/UI/MusicRoom.cs.uid
Normal file
1
Scripts/UI/MusicRoom.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c06tspxwnj7pg
|
||||
Loading…
Add table
Add a link
Reference in a new issue