2025-03-27 17:20:20 +03:00
|
|
|
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;
|
|
|
|
|
|
2025-07-27 13:47:05 +03:00
|
|
|
public CP14SkillTreeButtonControl(Color color, string label, float skillpoints, Texture? icon)
|
2025-03-27 17:20:20 +03:00
|
|
|
{
|
|
|
|
|
RobustXamlLoader.Load(this);
|
|
|
|
|
|
|
|
|
|
ColorPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = color };
|
2025-05-14 12:43:43 +03:00
|
|
|
if (skillpoints > 0)
|
|
|
|
|
{
|
2025-07-27 13:47:05 +03:00
|
|
|
SkillPointImage.Texture = icon;
|
2025-05-14 12:43:43 +03:00
|
|
|
SkillPointImage.Visible = true;
|
|
|
|
|
SkillTreeLabel.Text = $"{skillpoints} {label}";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SkillPointImage.Visible = false;
|
|
|
|
|
SkillTreeLabel.Text = $"{label}";
|
|
|
|
|
}
|
2025-03-27 17:20:20 +03:00
|
|
|
|
|
|
|
|
MainButton.OnPressed += args => OnPressed?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
}
|