Files
crystall-punk-14/Content.Client/Cargo/UI/CargoShuttleMenu.xaml.cs

64 lines
2.1 KiB
C#
Raw Permalink Normal View History

using Content.Client.UserInterface.Controls;
2022-06-23 14:36:47 +10:00
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()
2022-06-23 14:36:47 +10:00
{
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)
2022-06-23 14:36:47 +10:00
{
Orders.DisposeAllChildren();
foreach (var order in orders)
{
var product = protoManager.Index<EntityPrototype>(order.ProductId);
2022-06-23 14:36:47 +10:00
var productName = product.Name;
var row = new CargoOrderRow
{
Order = order,
Icon = { Texture = sprites.Frame0(product) },
2022-06-23 14:36:47 +10:00
ProductName =
{
Text = Loc.GetString(
"cargo-console-menu-populate-orders-cargo-order-row-product-name-text",
("productName", productName),
("orderAmount", order.OrderQuantity - order.NumDispatched),
2022-06-23 14:36:47 +10:00
("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);
}
}
}
}