Files
tbd-station-14/Content.Client/Cargo/UI/CargoShuttleMenu.xaml.cs
metalgearsloth edb05e36bb Reapply "Remove some BUI boilerplate" (#30214) (#30219)
* Reapply "Remove some BUI boilerplate" (#30214)

This reverts commit cb0ba66be3.

* Fix gas tank

* Fix PA

* Fix microwave

* Comms console underwrap

* Fix rcd

* log wehs
2024-07-21 14:48:13 +10:00

64 lines
2.1 KiB
C#

using Content.Client.UserInterface.Controls;
using Content.Shared.Cargo;
using Content.Shared.Cargo.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Client.Cargo.UI
{
[GenerateTypedNameReferences]
public sealed partial class CargoShuttleMenu : FancyWindow
{
public CargoShuttleMenu()
{
RobustXamlLoader.Load(this);
Title = Loc.GetString("cargo-shuttle-console-menu-title");
}
public void SetAccountName(string name)
{
AccountNameLabel.Text = name;
}
public void SetShuttleName(string name)
{
ShuttleNameLabel.Text = name;
}
public void SetOrders(SpriteSystem sprites, IPrototypeManager protoManager, List<CargoOrderData> orders)
{
Orders.DisposeAllChildren();
foreach (var order in orders)
{
var product = protoManager.Index<EntityPrototype>(order.ProductId);
var productName = product.Name;
var row = new CargoOrderRow
{
Order = order,
Icon = { Texture = sprites.Frame0(product) },
ProductName =
{
Text = Loc.GetString(
"cargo-console-menu-populate-orders-cargo-order-row-product-name-text",
("productName", productName),
("orderAmount", order.OrderQuantity - order.NumDispatched),
("orderRequester", order.Requester))
},
Description = {Text = Loc.GetString("cargo-console-menu-order-reason-description",
("reason", order.Reason))}
};
row.Approve.Visible = false;
row.Cancel.Visible = false;
Orders.AddChild(row);
}
}
}
}