Files
crystall-punk-14/Content.Client/_CP14/Workbench/CP14WorkbenchRecipeControl.xaml.cs
Ed b3eed32588 Workbench Refactor (#826)
* Workbench refactor

* fixes

* update all recipes protos

* scrap resprite

* scrap melting

* scrap weapon drop

* demiplane loot update

* weapon parts melting

* fix

* boilerplate

* material localization
2025-01-31 14:47:51 +03:00

50 lines
1.4 KiB
C#

/*
* This file is sublicensed under MIT License
* https://github.com/space-wizards/space-station-14/blob/master/LICENSE.TXT
*/
using Content.Shared._CP14.Workbench;
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.Workbench;
[GenerateTypedNameReferences]
public sealed partial class CP14WorkbenchRequirementControl : Control
{
[Dependency] private readonly IEntityManager _entity = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
private readonly SpriteSystem _sprite;
public CP14WorkbenchRequirementControl()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_sprite = _entity.System<SpriteSystem>();
}
public CP14WorkbenchRequirementControl(CP14WorkbenchCraftRequirement requirement) : this()
{
Name.Text = requirement.GetRequirementTitle(_proto);
var texture = requirement.GetRequirementTexture(_proto);
if (texture is not null)
{
View.Visible = true;
View.Texture = _sprite.Frame0(texture);
}
var entityView = requirement.GetRequirementEntityView(_proto);
if (entityView is not null)
{
EntityView.Visible = true;
EntityView.SetPrototype(entityView);
}
}
}