Show materials as sheets, tweak lathe ui (#19709)
This commit is contained in:
@@ -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;
|
||||
/// <summary>
|
||||
/// This widget is one row in the lathe eject menu.
|
||||
/// </summary>
|
||||
|
||||
[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<MaterialPrototype>(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);
|
||||
|
||||
Reference in New Issue
Block a user