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 = "\uff5e"; 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); } } }