mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 19:55:54 +00:00
Credits screen
This commit is contained in:
parent
6d572503cb
commit
90cc97c669
10 changed files with 210 additions and 8 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Cirno.Scripts.UI;
|
||||
|
||||
public partial class MainMenu : Control
|
||||
{
|
||||
|
|
@ -23,6 +24,10 @@ public partial class MainMenu : Control
|
|||
[ExportCategory("Debug Menu")]
|
||||
[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.
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
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