Files
tbd-station-14/Content.Client/Lathe/UI/LatheQueueMenu.xaml.cs
Nemanja 2e7dcb1ed8 Lathe Refactor and ECS (#11201)
* lathe and material storage refactor

* materialStorage ECS

it kinda sus tho

* beginning the lathe shitcode dive

* couple lathe visuals and lathe system

* lathe changes and such

* dynamic lathe databases

* rewrote internal logic

on to ui

* da newI

* material display clientside

* misc ui changes

* component state handling and various other things

* moar

* Update Content.Shared/Lathe/LatheComponent.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* first volley of sloth review

* more fixes

* losin' my mind

* all da changes

* test fix and other review

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2022-09-16 18:49:05 -05:00

53 lines
1.6 KiB
C#

using Content.Shared.Research.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.Lathe.UI
{
[GenerateTypedNameReferences]
public sealed partial class LatheQueueMenu : DefaultWindow
{
[Dependency] private readonly IEntityManager _entityManager = default!;
private readonly SpriteSystem _spriteSystem;
public LatheQueueMenu(LatheBoundUserInterface owner)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_spriteSystem = _entityManager.EntitySysManager.GetEntitySystem<SpriteSystem>();
SetInfo(null);
}
public void SetInfo(LatheRecipePrototype? recipe)
{
if (recipe != null)
{
Icon.Texture = _spriteSystem.Frame0(recipe.Icon);
NameLabel.Text = recipe.Name;
Description.Text = recipe.Description;
}
else
{
Icon.Texture = Texture.Transparent;
NameLabel.Text = string.Empty;
Description.Text = Loc.GetString("lathe-queue-menu-not-producing-text");
}
}
public void PopulateList(List<LatheRecipePrototype> queue)
{
QueueList.Clear();
var idx = 1;
foreach (var recipe in queue)
{
QueueList.AddItem($"{idx}. {recipe.Name}", _spriteSystem.Frame0(recipe.Icon));
idx++;
}
}
}
}