* pupu
* Update LICENSE.TXT
* CLA
* CLA!
* Revert "CLA!"
This reverts commit f999e341a1.
* CLA2
* Update rsi.json
* CLA3
* Workbench sublicense
49 lines
1.4 KiB
C#
49 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.Stacks;
|
|
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 CP14WorkbenchRecipeControl : Control
|
|
{
|
|
[Dependency] private readonly IEntityManager _entity = default!;
|
|
|
|
private readonly SpriteSystem _sprite;
|
|
|
|
public CP14WorkbenchRecipeControl()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
_sprite = _entity.System<SpriteSystem>();
|
|
}
|
|
|
|
public CP14WorkbenchRecipeControl(EntityPrototype prototype, int count) : this()
|
|
{
|
|
var entityName = prototype.Name;
|
|
Name.Text = count <= 1 ? entityName : $"{entityName} x{count}";
|
|
View.Texture = _sprite.GetPrototypeIcon(prototype).Default;
|
|
}
|
|
|
|
public CP14WorkbenchRecipeControl(StackPrototype prototype, int count) : this()
|
|
{
|
|
var entityName = Loc.GetString(prototype.Name);
|
|
Name.Text = $"{entityName} x{count}";
|
|
|
|
var icon = prototype.Icon;
|
|
if (icon is null)
|
|
return;
|
|
|
|
View.Texture = _sprite.Frame0(icon);
|
|
}
|
|
}
|