Lathes (#207)
* Recipe stuff. * Lathe GUI and stuff * god dammit * Lathe menu works, yay. * EventArgs henk * Some work * SS14 -> Robust * More SS14 -> Robust * Lathe materials * Lathe works, Lathe GUI, Queue GUI, etc too many changes to name them here * Remove materials button, add ViewVariables and update lathe on connect * Add Autolathe RSI * Adds new recipes, fixes a few bugs. * Remove unused ScrollContainers * Use same delegate for spawn. * Removes client-side LatheComponent in favor of BoundUserInterface * Remove GetMaterial and TryGetMaterial * Use auto-properties in a few places. * Adds LatheDatabase, and a bunch of other changes * Remove useless log. * Remove lathetype from prototypes. * Turns Storage, Lathe and Database into autoproperties * Remove Hacked property from LatheRecipePrototype * Remove unneeded dependency injection from components * Refactors LatheDatabaseComponent to use ComponentState * Refactors MaterialStorageComponent to use ComponentState * Oopsie * Another oopsie * Last oopsie, I hope * Fix missing Close call.
This commit is contained in:
committed by
Pieter-Jan Briers
parent
092539ae59
commit
fe0414eda7
149
Content.Client/Research/LatheQueueMenu.cs
Normal file
149
Content.Client/Research/LatheQueueMenu.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
using Content.Client.GameObjects.Components.Research;
|
||||
using Content.Shared.Research;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.Interfaces.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Client.Research
|
||||
{
|
||||
public class LatheQueueMenu : SS14Window
|
||||
{
|
||||
protected override Vector2? CustomSize => (300, 450);
|
||||
|
||||
public LatheBoundUserInterface Owner { get; set; }
|
||||
|
||||
[ViewVariables]
|
||||
private ItemList QueueList;
|
||||
private Label Name;
|
||||
private Label Description;
|
||||
private TextureRect Icon;
|
||||
|
||||
public LatheQueueMenu(IDisplayManager displayManager) : base(displayManager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
HideOnClose = true;
|
||||
Title = "Lathe Queue";
|
||||
Visible = false;
|
||||
|
||||
var margin = new MarginContainer()
|
||||
{
|
||||
MarginTop = 5f,
|
||||
MarginLeft = 5f,
|
||||
MarginRight = -5f,
|
||||
MarginBottom = -5f,
|
||||
};
|
||||
|
||||
margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
|
||||
|
||||
var vbox = new VBoxContainer();
|
||||
|
||||
vbox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
|
||||
|
||||
var descMargin = new MarginContainer()
|
||||
{
|
||||
MarginTop = 5f,
|
||||
MarginLeft = 5f,
|
||||
MarginRight = -5f,
|
||||
MarginBottom = -5f,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
SizeFlagsStretchRatio = 2,
|
||||
};
|
||||
|
||||
var hbox = new HBoxContainer()
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
};
|
||||
|
||||
Icon = new TextureRect()
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
SizeFlagsStretchRatio = 2,
|
||||
};
|
||||
|
||||
var vboxInfo = new VBoxContainer()
|
||||
{
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
SizeFlagsStretchRatio = 3,
|
||||
};
|
||||
|
||||
Name = new Label()
|
||||
{
|
||||
RectClipContent = true,
|
||||
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||
};
|
||||
|
||||
Description = new Label()
|
||||
{
|
||||
RectClipContent = true,
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||
|
||||
};
|
||||
|
||||
QueueList = new ItemList()
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
SizeFlagsStretchRatio = 3,
|
||||
SelectMode = ItemList.ItemListSelectMode.None
|
||||
};
|
||||
|
||||
vboxInfo.AddChild(Name);
|
||||
vboxInfo.AddChild(Description);
|
||||
|
||||
hbox.AddChild(Icon);
|
||||
hbox.AddChild(vboxInfo);
|
||||
|
||||
descMargin.AddChild(hbox);
|
||||
|
||||
vbox.AddChild(descMargin);
|
||||
vbox.AddChild(QueueList);
|
||||
|
||||
margin.AddChild(vbox);
|
||||
|
||||
Contents.AddChild(margin);
|
||||
|
||||
ClearInfo();
|
||||
}
|
||||
|
||||
public void SetInfo(LatheRecipePrototype recipe)
|
||||
{
|
||||
Icon.Texture = recipe.Icon.Frame0();
|
||||
if (recipe.Name != null)
|
||||
Name.Text = recipe.Name;
|
||||
if (recipe.Description != null)
|
||||
Description.Text = recipe.Description;
|
||||
}
|
||||
|
||||
public void ClearInfo()
|
||||
{
|
||||
Icon.Texture = Texture.Transparent;
|
||||
Name.Text = "-------";
|
||||
Description.Text = "Not producing anything.";
|
||||
}
|
||||
|
||||
public void PopulateList()
|
||||
{
|
||||
QueueList.Clear();
|
||||
var idx = 1;
|
||||
foreach (var recipe in Owner.QueuedRecipes)
|
||||
{
|
||||
QueueList.AddItem($"{idx}. {recipe.Name}", recipe.Icon.Frame0(), false);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user