Files
crystall-punk-14/Content.Client/_CP14/Skill/Ui/CP14SkillTreeButtonControl.xaml.cs

33 lines
932 B
C#
Raw Permalink Normal View History

using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
namespace Content.Client._CP14.Skill.Ui;
[GenerateTypedNameReferences]
public sealed partial class CP14SkillTreeButtonControl : Control
{
public event Action? OnPressed;
public CP14SkillTreeButtonControl(Color color, string label, float skillpoints, Texture? icon)
{
RobustXamlLoader.Load(this);
ColorPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = color };
if (skillpoints > 0)
{
SkillPointImage.Texture = icon;
SkillPointImage.Visible = true;
SkillTreeLabel.Text = $"{skillpoints} {label}";
}
else
{
SkillPointImage.Visible = false;
SkillTreeLabel.Text = $"{label}";
}
MainButton.OnPressed += args => OnPressed?.Invoke();
}
}