Make departmental orders consoles print slips (#36944)

* Make departmental orders consoles print slips

* feed back cycle
This commit is contained in:
pathetic meowmeow
2025-05-06 15:04:18 -04:00
committed by GitHub
parent f73f6d4467
commit cfba56c2b4
45 changed files with 649 additions and 27 deletions

View File

@@ -38,9 +38,10 @@
<!-- Products get added here by code -->
</BoxContainer>
</ScrollContainer>
<Control MinHeight="5"/>
<Control MinHeight="5" Name="OrdersSpacer"/>
<PanelContainer VerticalExpand="True"
SizeFlagsStretchRatio="1">
SizeFlagsStretchRatio="1"
Name="Orders">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#000000" />
</PanelContainer.PanelOverride>

View File

@@ -208,6 +208,7 @@ namespace Content.Client.Cargo.UI
var product = _protoManager.Index<EntityPrototype>(order.ProductId);
var productName = product.Name;
var account = _protoManager.Index(order.Account);
var row = new CargoOrderRow
{
@@ -219,7 +220,9 @@ namespace Content.Client.Cargo.UI
"cargo-console-menu-populate-orders-cargo-order-row-product-name-text",
("productName", productName),
("orderAmount", order.OrderQuantity),
("orderRequester", order.Requester))
("orderRequester", order.Requester),
("accountColor", account.Color),
("account", Loc.GetString(account.Code)))
},
Description =
{
@@ -282,6 +285,9 @@ namespace Content.Client.Cargo.UI
AccountActionButton.Disabled = TransferSpinBox.Value <= 0 ||
TransferSpinBox.Value > bankAccount.Accounts[orderConsole.Account] * orderConsole.TransferLimit ||
_timing.CurTime < orderConsole.NextAccountActionTime;
OrdersSpacer.Visible = !orderConsole.SlipPrinter;
Orders.Visible = !orderConsole.SlipPrinter;
}
}
}

View File

@@ -11,11 +11,10 @@
<BoxContainer Orientation="Vertical"
HorizontalExpand="True"
VerticalExpand="True">
<Label Name="ProductName"
<RichTextLabel Name="ProductName"
Access="Public"
HorizontalExpand="True"
StyleClasses="LabelSubText"
ClipText="True" />
StyleClasses="LabelSubText" />
<Label Name="Description"
Access="Public"
HorizontalExpand="True"

View File

@@ -36,6 +36,7 @@ namespace Content.Client.Cargo.UI
{
var product = protoManager.Index<EntityPrototype>(order.ProductId);
var productName = product.Name;
var account = protoManager.Index(order.Account);
var row = new CargoOrderRow
{
@@ -47,7 +48,9 @@ namespace Content.Client.Cargo.UI
"cargo-console-menu-populate-orders-cargo-order-row-product-name-text",
("productName", productName),
("orderAmount", order.OrderQuantity - order.NumDispatched),
("orderRequester", order.Requester))
("orderRequester", order.Requester),
("accountColor", account.Color),
("account", Loc.GetString(account.Code)))
},
Description = {Text = Loc.GetString("cargo-console-menu-order-reason-description",
("reason", order.Reason))}

View File

@@ -1,4 +1,5 @@
using System.Numerics;
using Robust.Shared.Utility;
namespace Content.Client.Paper.UI;
@@ -55,6 +56,24 @@ public sealed partial class PaperVisualsComponent : Component
[DataField("headerMargin")]
public Box2 HeaderMargin = default;
/// <summary>
/// A path to an image which will be used as a footer on the paper
/// </summary>
[DataField]
public ResPath? FooterImagePath;
/// <summary>
/// Modulate the footer image by this color
/// </summary>
[DataField]
public Color FooterImageModulate = Color.White;
/// <summary>
/// Any additional margin to add around the footer
/// </summary>
[DataField]
public Box2 FooterMargin = default;
/// <summary>
/// Path to an image to use as the background to the "content" of the paper
/// The header and actual written text will use this as a background. The

View File

@@ -22,6 +22,7 @@
</PanelContainer>
<Label Name="FillStatus" StyleClasses="LabelSecondaryColor"/>
</BoxContainer>
<TextureButton Name="FooterImage" HorizontalAlignment="Center" VerticalAlignment="Top" MouseFilter="Ignore"/>
</BoxContainer>
<paper:StampCollection Name="StampDisplay" VerticalAlignment="Bottom" Margin="6"/>

View File

@@ -149,6 +149,16 @@ namespace Content.Client.Paper.UI
HeaderImage.Margin = new Thickness(visuals.HeaderMargin.Left, visuals.HeaderMargin.Top,
visuals.HeaderMargin.Right, visuals.HeaderMargin.Bottom);
// Then the footer
if (visuals.FooterImagePath is {} path)
{
FooterImage.TexturePath = path.ToString();
FooterImage.MinSize = FooterImage.TextureNormal?.Size ?? Vector2.Zero;
}
FooterImage.ModulateSelfOverride = visuals.FooterImageModulate;
FooterImage.Margin = new Thickness(visuals.FooterMargin.Left, visuals.FooterMargin.Top,
visuals.FooterMargin.Right, visuals.FooterMargin.Bottom);
PaperContent.ModulateSelfOverride = visuals.ContentImageModulate;
WrittenTextLabel.ModulateSelfOverride = visuals.FontAccentColor;