mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
56 lines
No EOL
1.8 KiB
C#
56 lines
No EOL
1.8 KiB
C#
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);
|
|
}
|
|
}
|
|
} |