Add informations to cargo order form (#10513)

This commit is contained in:
corentt
2022-09-14 05:20:38 +02:00
committed by GitHub
parent 733090c95f
commit c4fde3b3eb
6 changed files with 31 additions and 3 deletions

View File

@@ -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<SpriteSystem>();
_menu = new CargoConsoleMenu(IoCManager.Resolve<IPrototypeManager>(), spriteSystem);
var localPlayer = IoCManager.Resolve<IPlayerManager>()?.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;

View File

@@ -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) },
};

View File

@@ -2,6 +2,17 @@
Title="{Loc 'cargo-console-order-menu-title'}">
<BoxContainer Orientation="Vertical">
<GridContainer Columns="2">
<Label Text="{Loc 'cargo-console-order-menu-product-label'}" />
<Label Name="ProductName"
Access="Public" />
<Label Text="{Loc 'cargo-console-order-menu-description-label'}" />
<RichTextLabel Name="Description"
Access="Public"
VerticalExpand="True"
SetWidth="350"/>
<Label Text="{Loc 'cargo-console-order-menu-cost-label'}" />
<Label Name="PointCost"
Access="Public" />
<Label Text="{Loc 'cargo-console-order-menu-requester-label'}" />
<LineEdit Name="Requester"
Access="Public" />

View File

@@ -2,6 +2,7 @@
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
HorizontalExpand="True">
<Button Name="MainButton"
ToolTip=""
Access="Public"
HorizontalExpand="True"
VerticalExpand="True" />

View File

@@ -1,7 +1,10 @@
## UI
cargo-console-order-menu-title = Order Form
cargo-console-order-menu-product-label = Product:
cargo-console-order-menu-description-label = Description:
cargo-console-order-menu-cost-label = Unit cost:
cargo-console-order-menu-requester-label = Name:
cargo-console-order-menu-reason-label = Reason:
cargo-console-order-menu-amount-label = Amount:
cargo-console-order-menu-submit-button = OK
cargo-console-order-menu-submit-button = OK

View File

@@ -14,7 +14,7 @@ ent-CrateFunBoardGames = Board game crate
.desc = Game nights have been proven to either decrease boredom or increase murderous rage depending on the game.
ent-CrateFunATV = ATV crate
.desc = Bring some jazz to the station with the brass ensemble. Contains a variety of brass instruments for the whole station to play.
.desc = An Absolutely Taxable Vehicle to help cargo with hauling.
ent-CrateFunSyndicateSegway = Syndicate segway crate
.desc = Bring some jazz to the station with the brass ensemble. Contains a variety of brass instruments for the whole station to play.
.desc = A crate containing a two-wheeler that will help you escape from the security officers. Or not.