Credits screen

This commit is contained in:
MaddoScientisto 2025-03-09 16:34:19 +01:00
commit 90cc97c669
10 changed files with 210 additions and 8 deletions

View file

@ -1,7 +1,15 @@
[gd_resource type="Resource" script_class="CreditsCollection" load_steps=10 format=3 uid="uid://cojsc1rtf41i1"]
[gd_resource type="Resource" script_class="CreditsCollection" load_steps=16 format=3 uid="uid://cojsc1rtf41i1"]
[ext_resource type="Script" uid="uid://buq8eurx510ps" path="res://Scripts/Resources/CreditsCollection.cs" id="1_0bwsf"]
[ext_resource type="Script" uid="uid://bc4f4ggvk3ktf" path="res://Scripts/Resources/CreditsEntry.cs" id="1_aaqha"]
[ext_resource type="LabelSettings" uid="uid://b7aiiua04uma4" path="res://Resources/Styles/Credits_Section_Style.tres" id="2_vda0h"]
[sub_resource type="Resource" id="Resource_1cmaw"]
script = ExtResource("1_aaqha")
Name = "Music"
Contribution = ""
CustomLabelSettings = ExtResource("2_vda0h")
metadata/_custom_type_script = "uid://bc4f4ggvk3ktf"
[sub_resource type="Resource" id="Resource_vda0h"]
script = ExtResource("1_aaqha")
@ -9,6 +17,26 @@ Name = "Fenekhu"
Contribution = "Music"
metadata/_custom_type_script = "uid://bc4f4ggvk3ktf"
[sub_resource type="Resource" id="Resource_daaek"]
script = ExtResource("1_aaqha")
Name = "Art"
Contribution = ""
CustomLabelSettings = ExtResource("2_vda0h")
metadata/_custom_type_script = "uid://bc4f4ggvk3ktf"
[sub_resource type="Resource" id="Resource_8vv0q"]
script = ExtResource("1_aaqha")
Name = "RayKeju"
Contribution = "Intro Art"
metadata/_custom_type_script = "uid://bc4f4ggvk3ktf"
[sub_resource type="Resource" id="Resource_321dv"]
script = ExtResource("1_aaqha")
Name = "Misc"
Contribution = ""
CustomLabelSettings = ExtResource("2_vda0h")
metadata/_custom_type_script = "uid://bc4f4ggvk3ktf"
[sub_resource type="Resource" id="Resource_j7pkh"]
script = ExtResource("1_aaqha")
Name = "alphatrooper18"
@ -45,7 +73,13 @@ Name = "guillermochicasonido"
Contribution = "Teleporter Sound"
metadata/_custom_type_script = "uid://bc4f4ggvk3ktf"
[sub_resource type="Resource" id="Resource_ivgyk"]
script = ExtResource("1_aaqha")
Name = "Alexander Nikopoulos"
Contribution = "VFEZ"
metadata/_custom_type_script = "uid://bc4f4ggvk3ktf"
[resource]
script = ExtResource("1_0bwsf")
Credits = Array[ExtResource("1_aaqha")]([SubResource("Resource_vda0h"), SubResource("Resource_j7pkh"), SubResource("Resource_aaqha"), SubResource("Resource_gr2tg"), SubResource("Resource_b8hlh"), SubResource("Resource_gbaov"), SubResource("Resource_jkmrk")])
Credits = Array[ExtResource("1_aaqha")]([SubResource("Resource_1cmaw"), SubResource("Resource_vda0h"), SubResource("Resource_daaek"), SubResource("Resource_8vv0q"), SubResource("Resource_321dv"), SubResource("Resource_j7pkh"), SubResource("Resource_aaqha"), SubResource("Resource_gr2tg"), SubResource("Resource_b8hlh"), SubResource("Resource_gbaov"), SubResource("Resource_jkmrk"), SubResource("Resource_ivgyk")])
metadata/_custom_type_script = "uid://buq8eurx510ps"

View file

@ -0,0 +1,10 @@
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://b7aiiua04uma4"]
[ext_resource type="FontFile" uid="uid://coek1e2q257pq" path="res://fonts/at01.ttf" id="1_36nji"]
[resource]
font = ExtResource("1_36nji")
font_size = 18
font_color = Color(1, 1, 0.2, 1)
outline_size = 1
outline_color = Color(0.176871, 0.175749, 2.40654e-08, 1)

View file

@ -5,6 +5,6 @@
[resource]
line_spacing = 1.0
font = ExtResource("1_foybo")
font_size = 12
font_size = 14
outline_size = 3
outline_color = Color(0, 0, 0, 1)

View file

@ -0,0 +1,85 @@
[gd_scene load_steps=9 format=3 uid="uid://cmdf7cbqbxedj"]
[ext_resource type="Script" uid="uid://bbssj2rkbqysu" path="res://Scripts/UI/CreditsMenu.cs" id="1_7p0um"]
[ext_resource type="Resource" uid="uid://cojsc1rtf41i1" path="res://Resources/Credits.tres" id="2_6xeqb"]
[ext_resource type="Theme" uid="uid://dnsadvmunm76k" path="res://Resources/Styles/MainMenuButtons.tres" id="2_ahn81"]
[ext_resource type="FontFile" uid="uid://ccm3u37q1hvux" path="res://fonts/Xolonium-Regular.ttf" id="3_6xeqb"]
[ext_resource type="LabelSettings" uid="uid://buk3e7bbwmnv1" path="res://Resources/Styles/Hud_Text_Style.tres" id="3_xr5nf"]
[ext_resource type="StyleBox" uid="uid://ctw2hju32l3rg" path="res://Resources/Styles/PixelStyleBoxRed.tres" id="6_v8423"]
[ext_resource type="LabelSettings" uid="uid://b7aiiua04uma4" path="res://Resources/Styles/Credits_Section_Style.tres" id="7_5tqy8"]
[sub_resource type="LabelSettings" id="LabelSettings_xr5nf"]
font = ExtResource("3_6xeqb")
font_size = 20
outline_size = 4
outline_color = Color(0, 0, 0, 1)
[node name="CreditsMenu" type="VBoxContainer" node_paths=PackedStringArray("CreditsContainer")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_7p0um")
Credits = ExtResource("2_6xeqb")
CreditsContainer = NodePath("ScrollContainer/VBoxContainer")
LabelSettings = ExtResource("3_xr5nf")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 2
[node name="BackButton" type="Button" parent="HBoxContainer"]
layout_mode = 2
size_flags_vertical = 4
theme = ExtResource("2_ahn81")
text = "Back"
[node name="Name" type="Label" parent="HBoxContainer"]
layout_mode = 2
text = "CREDITS"
label_settings = SubResource("LabelSettings_xr5nf")
horizontal_alignment = 1
[node name="ScrollContainer" type="ScrollContainer" parent="."]
layout_mode = 2
size_flags_vertical = 3
theme = ExtResource("2_ahn81")
theme_override_styles/panel = ExtResource("6_v8423")
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="HBoxContainer" type="HBoxContainer" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
[node name="Label" type="Label" parent="ScrollContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "asdf"
label_settings = ExtResource("3_xr5nf")
[node name="Label2" type="Label" parent="ScrollContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "fdas"
label_settings = ExtResource("3_xr5nf")
[node name="Label3" type="Label" parent="ScrollContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "gfdsgfdsg"
[node name="Label4" type="Label" parent="ScrollContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Title"
label_settings = ExtResource("7_5tqy8")
[node name="HBoxContainer2" type="HBoxContainer" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
[node name="Label" type="Label" parent="ScrollContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "TEST"
label_settings = ExtResource("7_5tqy8")
[connection signal="pressed" from="HBoxContainer/BackButton" to="." method="_on_back_button_pressed"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://5xajclchk3my"]
[gd_scene load_steps=17 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"]
@ -6,6 +6,7 @@
[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="PackedScene" uid="uid://cmdf7cbqbxedj" path="res://Scenes/HUD/CreditsMenu.tscn" id="4_8e205"]
[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"]
@ -23,7 +24,7 @@ font_size = 12
outline_size = 4
outline_color = Color(0, 0, 0, 1)
[node name="Control" type="Control" node_paths=PackedStringArray("SubMenuHolder", "MusicPlayer")]
[node name="MainMenu" type="Control" node_paths=PackedStringArray("SubMenuHolder", "MusicPlayer")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@ -39,6 +40,7 @@ SubMenuHolder = NodePath("SubMenuContainer")
MusicPlayer = NodePath("AudioStreamPlayer2D")
MusicRoomTemplate = ExtResource("2_if7li")
DebugMenuTemplate = ExtResource("9_nwlsr")
CreditsMenuTemplate = ExtResource("4_8e205")
[node name="TextureRect2" type="TextureRect" parent="."]
layout_mode = 0
@ -167,3 +169,4 @@ theme_override_styles/panel = ExtResource("7_rrcx7")
[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"]
[connection signal="pressed" from="MarginContainer/GridContainer/Options/CreditsButton" to="." method="OnCreditsButtonPressed"]

View file

@ -1,5 +1,6 @@
using Godot;
using System;
using Cirno.Scripts.UI;
public partial class MainMenu : Control
{
@ -24,6 +25,10 @@ public partial class MainMenu : Control
[Export]
public PackedScene DebugMenuTemplate { get; set; }
[ExportCategory("Credits Menu")]
[Export]
public PackedScene CreditsMenuTemplate { get; set; }
// Called when the node enters the scene tree for the first time.
public override void _Ready()
@ -98,6 +103,11 @@ public partial class MainMenu : Control
};
}
private void OnCreditsButtonPressed()
{
SpawnMenu<CreditsMenu>(CreditsMenuTemplate, SubMenuHolder);
}
private void _on_mainmenu_button_pressed()
{
if (MainMenuScene != null)

View file

@ -6,7 +6,10 @@ namespace Cirno.Scripts.Resources;
public partial class CreditsEntry : Resource
{
[Export]
public string Name { get; set; }
public string Name { get; private set; }
[Export]
public string Contribution { get; set; }
public string Contribution { get; private set; }
[Export]
public LabelSettings CustomLabelSettings { get; private set; }
}

56
Scripts/UI/CreditsMenu.cs Normal file
View file

@ -0,0 +1,56 @@
using Cirno.Scripts.Resources;
using Godot;
namespace Cirno.Scripts.UI;
public partial class CreditsMenu : MenuBase
{
[Export]
public CreditsCollection Credits { get; private set; }
[Export]
public Container CreditsContainer { get; private set; }
[Export]
public LabelSettings LabelSettings { get; private set; }
public override void _Ready()
{
var children = CreditsContainer.GetChildren();
foreach (var child in children)
{
child.QueueFree();
}
foreach (var credit in Credits.Credits)
{
var cont = new HBoxContainer();
cont.SizeFlagsHorizontal = SizeFlags.ShrinkCenter;
if (!string.IsNullOrWhiteSpace(credit.Name))
{
var nameLabel = new Label();
nameLabel.Text = credit.Name;
nameLabel.LabelSettings = credit.CustomLabelSettings ?? LabelSettings;
cont.AddChild(nameLabel);
}
if (!string.IsNullOrWhiteSpace(credit.Name) && !string.IsNullOrWhiteSpace(credit.Contribution))
{
var dashLabel = new Label();
dashLabel.Text = "-";
dashLabel.LabelSettings = credit.CustomLabelSettings ?? LabelSettings;
cont.AddChild(dashLabel);
}
if (!string.IsNullOrWhiteSpace(credit.Contribution))
{
var descriptionLabel = new Label();
descriptionLabel.Text = credit.Contribution;
descriptionLabel.LabelSettings = credit.CustomLabelSettings ?? LabelSettings;
cont.AddChild(descriptionLabel);
}
CreditsContainer.AddChild(cont);
}
}
}

View file

@ -0,0 +1 @@
uid://bbssj2rkbqysu

View file

@ -6,7 +6,7 @@ using Godot.Collections;
public partial class MusicRoom : MenuBase
{
[Export]
public Array<MusicResource> Tracks { get; private set; } = new();
public Array<MusicResource> Tracks { get; private set; } = [];
[Export]
public ItemList TracksContainer { get; private set; }