mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-07 20:05:55 +00:00
Credits screen
This commit is contained in:
parent
6d572503cb
commit
90cc97c669
10 changed files with 210 additions and 8 deletions
56
Scripts/UI/CreditsMenu.cs
Normal file
56
Scripts/UI/CreditsMenu.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Scripts/UI/CreditsMenu.cs.uid
Normal file
1
Scripts/UI/CreditsMenu.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bbssj2rkbqysu
|
||||
|
|
@ -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; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue