From 6695ac2ad6dd09b922df390975a7bd3e81d8255c Mon Sep 17 00:00:00 2001
From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
Date: Fri, 1 Sep 2023 01:28:08 -0400
Subject: [PATCH] Show materials as sheets, tweak lathe ui (#19709)
---
.../Lathe/UI/LatheMaterialEjector.xaml.cs | 21 ++++++---
Content.Client/Lathe/UI/LatheMenu.xaml | 47 +++++++++----------
Content.Client/Lathe/UI/LatheMenu.xaml.cs | 39 ++++++---------
Content.Server/Lathe/LatheSystem.cs | 12 +++--
.../Locale/en-US/lathe/ui/lathe-menu.ftl | 11 ++++-
.../Lathes/1 sheet = 100cm3 of material.txt | 1 -
6 files changed, 71 insertions(+), 60 deletions(-)
delete mode 100644 Resources/Prototypes/Recipes/Lathes/1 sheet = 100cm3 of material.txt
diff --git a/Content.Client/Lathe/UI/LatheMaterialEjector.xaml.cs b/Content.Client/Lathe/UI/LatheMaterialEjector.xaml.cs
index 090a189c71..faa397a594 100644
--- a/Content.Client/Lathe/UI/LatheMaterialEjector.xaml.cs
+++ b/Content.Client/Lathe/UI/LatheMaterialEjector.xaml.cs
@@ -1,3 +1,4 @@
+using Content.Client.Stylesheets;
using Content.Shared.Materials;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
@@ -10,7 +11,6 @@ namespace Content.Client.Lathe.UI;
///
/// This widget is one row in the lathe eject menu.
///
-
[GenerateTypedNameReferences]
public sealed partial class LatheMaterialEjector : PanelContainer
{
@@ -34,19 +34,28 @@ public sealed partial class LatheMaterialEjector : PanelContainer
public void PopulateButtons(int maxEjectableSheets)
{
- int[] sheetsToEjectArray = { 1, 5, 10, 30 };
+ int[] sheetsToEjectArray = { 1, 5, 10 };
- foreach (int sheetsToEject in sheetsToEjectArray)
+ for (var i = 0; i < sheetsToEjectArray.Length; i++)
{
- var button = new Button()
+ var sheetsToEject = sheetsToEjectArray[i];
+
+ var styleClass = StyleBase.ButtonOpenBoth;
+ if (i == 0)
+ styleClass = StyleBase.ButtonOpenRight;
+ else if (i == sheetsToEjectArray.Length - 1)
+ styleClass = StyleBase.ButtonOpenLeft;
+
+ var button = new Button
{
Name = $"{sheetsToEject}",
Access = AccessLevel.Public,
Text = Loc.GetString($"{sheetsToEject}"),
MinWidth = 45,
+ StyleClasses = { styleClass }
};
- button.OnPressed += (_) =>
+ button.OnPressed += _ =>
{
OnEjectPressed?.Invoke(Material, sheetsToEject);
};
@@ -55,7 +64,7 @@ public sealed partial class LatheMaterialEjector : PanelContainer
if (_prototypeManager.TryIndex(Material, out var proto))
{
- button.ToolTip = Loc.GetString("lathe-menu-tooltip-display", ("amount", sheetsToEject * VolumePerSheet), ("material", Loc.GetString(proto.Name)));
+ button.ToolTip = Loc.GetString("lathe-menu-tooltip-display", ("amount", sheetsToEject), ("material", Loc.GetString(proto.Name)));
}
Content.AddChild(button);
diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml b/Content.Client/Lathe/UI/LatheMenu.xaml
index 89ca672097..539c08d652 100644
--- a/Content.Client/Lathe/UI/LatheMenu.xaml
+++ b/Content.Client/Lathe/UI/LatheMenu.xaml
@@ -18,18 +18,6 @@
VerticalExpand="True"
HorizontalExpand="True"
SeparationOverride="5">
-
-
-
-
+
-
+ SeparationOverride="5">
+
+
+
+
@@ -99,16 +98,16 @@
+ Name="Icon"
+ HorizontalExpand="True"
+ SizeFlagsStretchRatio="2"
+ Margin="100 0 0 0">