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

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; }