2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Research.Prototypes;
|
2019-04-26 15:51:05 +02:00
|
|
|
using Robust.Client.Graphics;
|
|
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
|
|
|
using Robust.Client.Utility;
|
2021-02-21 12:38:56 +01:00
|
|
|
using Robust.Shared.Localization;
|
2019-04-26 15:51:05 +02:00
|
|
|
using Robust.Shared.ViewVariables;
|
2021-07-18 18:39:31 +02:00
|
|
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
2019-04-26 15:51:05 +02:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Lathe.UI
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class LatheQueueMenu : DefaultWindow
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
|
|
|
|
public LatheBoundUserInterface Owner { get; set; }
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
2020-11-21 14:02:00 +01:00
|
|
|
private readonly ItemList _queueList;
|
|
|
|
|
private readonly Label _nameLabel;
|
|
|
|
|
private readonly Label _description;
|
|
|
|
|
private readonly TextureRect _icon;
|
2019-04-26 15:51:05 +02:00
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
public LatheQueueMenu(LatheBoundUserInterface owner)
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
Owner = owner;
|
2021-02-21 12:38:56 +01:00
|
|
|
SetSize = MinSize = (300, 450);
|
2021-05-21 15:39:33 +02:00
|
|
|
Title = Loc.GetString("lathequeue-menu-title");
|
2019-04-26 15:51:05 +02:00
|
|
|
|
2021-07-18 18:39:31 +02:00
|
|
|
var vBox = new BoxContainer
|
|
|
|
|
{
|
|
|
|
|
Orientation = LayoutOrientation.Vertical
|
|
|
|
|
};
|
2019-04-26 15:51:05 +02:00
|
|
|
|
2021-07-18 18:39:31 +02:00
|
|
|
var hBox = new BoxContainer
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
2021-07-18 18:39:31 +02:00
|
|
|
Orientation = LayoutOrientation.Horizontal,
|
2021-02-21 12:38:56 +01:00
|
|
|
HorizontalExpand = true,
|
|
|
|
|
SizeFlagsStretchRatio = 2,
|
2019-04-26 15:51:05 +02:00
|
|
|
};
|
|
|
|
|
|
2020-11-21 14:02:00 +01:00
|
|
|
_icon = new TextureRect()
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
2021-02-21 12:38:56 +01:00
|
|
|
HorizontalExpand = true,
|
2019-04-26 15:51:05 +02:00
|
|
|
SizeFlagsStretchRatio = 2,
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-18 18:39:31 +02:00
|
|
|
var vBoxInfo = new BoxContainer
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
2021-07-18 18:39:31 +02:00
|
|
|
Orientation = LayoutOrientation.Vertical,
|
2021-02-21 12:38:56 +01:00
|
|
|
VerticalExpand = true,
|
2019-04-26 15:51:05 +02:00
|
|
|
SizeFlagsStretchRatio = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-21 14:02:00 +01:00
|
|
|
_nameLabel = new Label()
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
|
|
|
|
RectClipContent = true,
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-21 14:02:00 +01:00
|
|
|
_description = new Label()
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
|
|
|
|
RectClipContent = true,
|
2021-02-21 12:38:56 +01:00
|
|
|
VerticalAlignment = VAlignment.Stretch,
|
|
|
|
|
VerticalExpand = true
|
2019-04-26 15:51:05 +02:00
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-21 14:02:00 +01:00
|
|
|
_queueList = new ItemList()
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
2021-02-21 12:38:56 +01:00
|
|
|
VerticalExpand = true,
|
2019-04-26 15:51:05 +02:00
|
|
|
SizeFlagsStretchRatio = 3,
|
|
|
|
|
SelectMode = ItemList.ItemListSelectMode.None
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-21 14:02:00 +01:00
|
|
|
vBoxInfo.AddChild(_nameLabel);
|
|
|
|
|
vBoxInfo.AddChild(_description);
|
2019-04-26 15:51:05 +02:00
|
|
|
|
2020-11-21 14:02:00 +01:00
|
|
|
hBox.AddChild(_icon);
|
2019-08-14 22:04:35 +02:00
|
|
|
hBox.AddChild(vBoxInfo);
|
2019-04-26 15:51:05 +02:00
|
|
|
|
2021-02-21 12:38:56 +01:00
|
|
|
vBox.AddChild(hBox);
|
2020-11-21 14:02:00 +01:00
|
|
|
vBox.AddChild(_queueList);
|
2019-04-26 15:51:05 +02:00
|
|
|
|
2021-02-21 12:38:56 +01:00
|
|
|
Contents.AddChild(vBox);
|
2019-04-26 15:51:05 +02:00
|
|
|
|
|
|
|
|
ClearInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetInfo(LatheRecipePrototype recipe)
|
|
|
|
|
{
|
2020-11-21 14:02:00 +01:00
|
|
|
_icon.Texture = recipe.Icon.Frame0();
|
2019-04-26 15:51:05 +02:00
|
|
|
if (recipe.Name != null)
|
2020-11-21 14:02:00 +01:00
|
|
|
_nameLabel.Text = recipe.Name;
|
2019-04-26 15:51:05 +02:00
|
|
|
if (recipe.Description != null)
|
2020-11-21 14:02:00 +01:00
|
|
|
_description.Text = recipe.Description;
|
2019-04-26 15:51:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ClearInfo()
|
|
|
|
|
{
|
2020-11-21 14:02:00 +01:00
|
|
|
_icon.Texture = Texture.Transparent;
|
|
|
|
|
_nameLabel.Text = "-------";
|
2021-07-10 10:14:06 +02:00
|
|
|
_description.Text = Loc.GetString("lathequeue-menu-not-producing-text");
|
2019-04-26 15:51:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PopulateList()
|
|
|
|
|
{
|
2020-11-21 14:02:00 +01:00
|
|
|
_queueList.Clear();
|
2019-04-26 15:51:05 +02:00
|
|
|
var idx = 1;
|
|
|
|
|
foreach (var recipe in Owner.QueuedRecipes)
|
|
|
|
|
{
|
2020-11-21 14:02:00 +01:00
|
|
|
_queueList.AddItem($"{idx}. {recipe.Name}", recipe.Icon.Frame0());
|
2019-04-26 15:51:05 +02:00
|
|
|
idx++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|