1
0

CargoShuttleMenu.xaml.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Content.Client.UserInterface.Controls;
  2. using Content.Shared.Cargo;
  3. using Content.Shared.Cargo.Prototypes;
  4. using Robust.Client.AutoGenerated;
  5. using Robust.Client.GameObjects;
  6. using Robust.Client.UserInterface.XAML;
  7. using Robust.Shared.Prototypes;
  8. using Robust.Shared.Timing;
  9. namespace Content.Client.Cargo.UI
  10. {
  11. [GenerateTypedNameReferences]
  12. public sealed partial class CargoShuttleMenu : FancyWindow
  13. {
  14. public CargoShuttleMenu()
  15. {
  16. RobustXamlLoader.Load(this);
  17. Title = Loc.GetString("cargo-shuttle-console-menu-title");
  18. }
  19. public void SetAccountName(string name)
  20. {
  21. AccountNameLabel.Text = name;
  22. }
  23. public void SetShuttleName(string name)
  24. {
  25. ShuttleNameLabel.Text = name;
  26. }
  27. public void SetOrders(SpriteSystem sprites, IPrototypeManager protoManager, List<CargoOrderData> orders)
  28. {
  29. Orders.DisposeAllChildren();
  30. foreach (var order in orders)
  31. {
  32. var product = protoManager.Index<EntityPrototype>(order.ProductId);
  33. var productName = product.Name;
  34. var row = new CargoOrderRow
  35. {
  36. Order = order,
  37. Icon = { Texture = sprites.Frame0(product) },
  38. ProductName =
  39. {
  40. Text = Loc.GetString(
  41. "cargo-console-menu-populate-orders-cargo-order-row-product-name-text",
  42. ("productName", productName),
  43. ("orderAmount", order.OrderQuantity - order.NumDispatched),
  44. ("orderRequester", order.Requester))
  45. },
  46. Description = {Text = Loc.GetString("cargo-console-menu-order-reason-description",
  47. ("reason", order.Reason))}
  48. };
  49. row.Approve.Visible = false;
  50. row.Cancel.Visible = false;
  51. Orders.AddChild(row);
  52. }
  53. }
  54. }
  55. }