Margin="5 0 0 0"
Text="{Loc 'lathe-menu-fabricating-message'}">
</Label>
- <TextureRect
- Name="Icon"
- HorizontalExpand="True"
- SizeFlagsStretchRatio="2"
- Margin="100 0 0 0">
- </TextureRect>
+ <EntityPrototypeView
+ Name="FabricatingEntityProto"
+ HorizontalAlignment="Left"
+ Margin="100 0 0 0"
+ />
<Label
Name="NameLabel"
RectClipContent="True"
</Label>
</PanelContainer>
</BoxContainer>
- <ItemList
- Name="QueueList"
- VerticalExpand="True"
- SizeFlagsStretchRatio="3"
- SelectMode="None">
- </ItemList>
+ <ScrollContainer VerticalExpand="True" HScrollEnabled="False">
+ <BoxContainer
+ Name="QueueList"
+ Orientation="Vertical"
+ HorizontalExpand="True"
+ VerticalExpand="True"
+ RectClipContent="True">
+ </BoxContainer>
+ </ScrollContainer>
</BoxContainer>
<BoxContainer
VerticalExpand="True"
RecipeList.Children.Clear();
foreach (var prototype in sortedRecipesToShow)
{
- List<Texture> textures;
+ EntityPrototype? recipeProto = null;
if (_prototypeManager.TryIndex(prototype.Result, out EntityPrototype? entityProto) && entityProto != null)
- {
- textures = SpriteComponent.GetPrototypeTextures(entityProto, _resources).Select(o => o.Default).ToList();
- }
- else
- {
- textures = prototype.Icon == null
- ? new List<Texture> { _spriteSystem.GetPrototypeIcon(prototype.Result).Default }
- : new List<Texture> { _spriteSystem.Frame0(prototype.Icon) };
- }
+ recipeProto = entityProto;
var canProduce = _lathe.CanProduce(_owner, prototype, quantity);
- var control = new RecipeControl(prototype, () => GenerateTooltipText(prototype), canProduce, textures);
+ var control = new RecipeControl(prototype, () => GenerateTooltipText(prototype), canProduce, recipeProto);
control.OnButtonPressed += s =>
{
if (!int.TryParse(AmountLineEdit.Text, out var amount) || amount <= 0)
/// <param name="queue"></param>
public void PopulateQueueList(List<LatheRecipePrototype> queue)
{
- QueueList.Clear();
+ QueueList.DisposeAllChildren();
+
var idx = 1;
foreach (var recipe in queue)
{
- var icon = recipe.Icon == null
- ? _spriteSystem.GetPrototypeIcon(recipe.Result).Default
- : _spriteSystem.Frame0(recipe.Icon);
- QueueList.AddItem($"{idx}. {recipe.Name}", icon);
+ var queuedRecipeBox = new BoxContainer();
+ queuedRecipeBox.Orientation = BoxContainer.LayoutOrientation.Horizontal;
+
+ var queuedRecipeProto = new EntityPrototypeView();
+ if (_prototypeManager.TryIndex(recipe.Result, out EntityPrototype? entityProto) && entityProto != null)
+ queuedRecipeProto.SetPrototype(entityProto);
+
+ var queuedRecipeLabel = new Label();
+ queuedRecipeLabel.Text = $"{idx}. {recipe.Name}";
+ queuedRecipeBox.AddChild(queuedRecipeProto);
+ queuedRecipeBox.AddChild(queuedRecipeLabel);
+ QueueList.AddChild(queuedRecipeBox);
idx++;
}
}
FabricatingContainer.Visible = recipe != null;
if (recipe == null)
return;
- Icon.Texture = recipe.Icon == null
- ? _spriteSystem.GetPrototypeIcon(recipe.Result).Default
- : _spriteSystem.Frame0(recipe.Icon);
+
+ if (_prototypeManager.TryIndex(recipe.Result, out EntityPrototype? entityProto) && entityProto != null)
+ FabricatingEntityProto.SetPrototype(entityProto);
+
NameLabel.Text = $"{recipe.Name}";
}
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Prototypes;
namespace Content.Client.Lathe.UI;
public Action<string>? OnButtonPressed;
public Func<string> TooltipTextSupplier;
- public RecipeControl(LatheRecipePrototype recipe, Func<string> tooltipTextSupplier, bool canProduce, List<Texture> textures)
+ public RecipeControl(LatheRecipePrototype recipe, Func<string> tooltipTextSupplier, bool canProduce, EntityPrototype? entityPrototype = null)
{
RobustXamlLoader.Load(this);
RecipeName.Text = recipe.Name;
- RecipeTextures.Textures = textures;
+ if (entityPrototype != null)
+ RecipePrototype.SetPrototype(entityPrototype);
Button.Disabled = !canProduce;
TooltipTextSupplier = tooltipTextSupplier;
Button.TooltipSupplier = SupplyTooltip;