From c4fde3b3ebb528df3b61c20a6df5ebf0315fad9c Mon Sep 17 00:00:00 2001 From: corentt <36075110+corentt@users.noreply.github.com> Date: Wed, 14 Sep 2022 05:20:38 +0200 Subject: [PATCH] Add informations to cargo order form (#10513) --- .../Cargo/BUI/CargoOrderConsoleBoundUserInterface.cs | 12 ++++++++++++ Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs | 1 + Content.Client/Cargo/UI/CargoConsoleOrderMenu.xaml | 11 +++++++++++ Content.Client/Cargo/UI/CargoProductRow.xaml | 1 + .../en-US/cargo/cargo-console-order-component.ftl | 5 ++++- .../prototypes/catalog/fills/crates/fun-crates.ftl | 4 ++-- 6 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Content.Client/Cargo/BUI/CargoOrderConsoleBoundUserInterface.cs b/Content.Client/Cargo/BUI/CargoOrderConsoleBoundUserInterface.cs index 83f07a3678..cf51221cd8 100644 --- a/Content.Client/Cargo/BUI/CargoOrderConsoleBoundUserInterface.cs +++ b/Content.Client/Cargo/BUI/CargoOrderConsoleBoundUserInterface.cs @@ -6,6 +6,7 @@ using Content.Shared.Cargo.Prototypes; using Content.Shared.IdentityManagement; using Robust.Client.GameObjects; using Robust.Client.Player; +using Robust.Shared.Utility; using Robust.Shared.Prototypes; using static Robust.Client.UserInterface.Controls.BaseButton; @@ -52,6 +53,7 @@ namespace Content.Client.Cargo.BUI var spriteSystem = sysManager.GetEntitySystem(); _menu = new CargoConsoleMenu(IoCManager.Resolve(), spriteSystem); var localPlayer = IoCManager.Resolve()?.LocalPlayer?.ControlledEntity; + var description = new FormattedMessage(); string orderRequester; @@ -68,10 +70,20 @@ namespace Content.Client.Cargo.BUI { if (args.Button.Parent is not CargoProductRow row) return; + + description.Clear(); + description.PushColor(Color.White); // Rich text default color is grey + if (row.MainButton.ToolTip != null) + description.AddText(row.MainButton.ToolTip); + _orderMenu.Description.SetMessage(description); + _product = row.Product; + _orderMenu.ProductName.Text = row.ProductName.Text; + _orderMenu.PointCost.Text = row.PointCost.Text; _orderMenu.Requester.Text = orderRequester; _orderMenu.Reason.Text = ""; _orderMenu.Amount.Value = 1; + _orderMenu.OpenCentered(); }; _menu.OnOrderApproved += ApproveOrder; diff --git a/Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs b/Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs index 7fb090d9a8..9f6cba8483 100644 --- a/Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs +++ b/Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs @@ -79,6 +79,7 @@ namespace Content.Client.Cargo.UI { Product = prototype, ProductName = { Text = prototype.Name }, + MainButton = { ToolTip = prototype.Description }, PointCost = { Text = Loc.GetString("cargo-console-menu-points-amount", ("amount", prototype.PointCost.ToString())) }, Icon = { Texture = _spriteSystem.Frame0(prototype.Icon) }, }; diff --git a/Content.Client/Cargo/UI/CargoConsoleOrderMenu.xaml b/Content.Client/Cargo/UI/CargoConsoleOrderMenu.xaml index 7d0fbc61c5..0a8f024a58 100644 --- a/Content.Client/Cargo/UI/CargoConsoleOrderMenu.xaml +++ b/Content.Client/Cargo/UI/CargoConsoleOrderMenu.xaml @@ -2,6 +2,17 @@ Title="{Loc 'cargo-console-order-menu-title'}"> +