Files
crystall-punk-14/Content.Client/_CP14/ResearchTable/CP14ResearchRecipeControl.xaml.cs
Ed be495f274c Skill progression system (#1263)
* delete skill trees

* Revert "delete skill trees"

This reverts commit 9d7fae73c4.

* learning refactor

* UI tweaks

* sword mastery skill

* telegraphy

* rapier mastery

* research table ui

* finish studing

* polish UI researching

* pyrokinetic

* more skill tree working

* heat adapt

* alchemist and metamagic update

* skill multiple effects support + metamagic bugg manapool

* impossible 😢

* skimitar gaming

* skimidi

* blacksmithing branch

* remove research restrictions

* remove species magic buff

* fix loc

* Update thaumaturgy.yml

* pip

* Delete skill_tree.yml
2025-05-14 12:43:43 +03:00

61 lines
1.7 KiB
C#

using Content.Shared._CP14.Skill;
using Content.Shared._CP14.Skill.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
namespace Content.Client._CP14.ResearchTable;
[GenerateTypedNameReferences]
public sealed partial class CP14ResearchRecipeControl : Control
{
[Dependency] private readonly IEntityManager _entity = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
public event Action<CP14ResearchUiEntry, CP14SkillPrototype>? OnResearch;
private readonly SpriteSystem _sprite;
private readonly CP14SharedSkillSystem _skillSystem;
private readonly CP14SkillPrototype _skillPrototype;
private readonly bool _craftable;
public CP14ResearchRecipeControl(CP14ResearchUiEntry entry)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_sprite = _entity.System<SpriteSystem>();
_skillSystem = _entity.System<CP14SharedSkillSystem>();
_skillPrototype = _prototype.Index(entry.ProtoId);
_craftable = entry.Craftable;
Button.OnPressed += _ => OnResearch?.Invoke(entry, _skillPrototype);
UpdateColor();
UpdateName();
UpdateView();
}
private void UpdateColor()
{
if (_craftable)
return;
Button.ModulateSelfOverride = Color.FromHex("#302622");
}
private void UpdateName()
{
Name.Text = $"{Loc.GetString(_skillSystem.GetSkillName(_skillPrototype))}" ;
}
private void UpdateView()
{
View.Texture =_sprite.Frame0(_skillPrototype.Icon);
}
}