Cargo console to XAML (#4973)
* Add and rename files * CargoConsoleOrderMenu to XAML * Cleanup imports * Add and rename files * CargoConsoleMenu to XAML * Improve code * CargoOrderRow/CargoProductRow to seperate files * CargoOrderRow to XAML * CargoProductRow to XAML
This commit is contained in:
@@ -1,516 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Content.Client.Stylesheets;
|
|
||||||
using Content.Shared.Cargo;
|
|
||||||
using Robust.Client.Graphics;
|
|
||||||
using Robust.Client.UserInterface.Controls;
|
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
|
||||||
using Robust.Client.Utility;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
|
||||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
|
||||||
|
|
||||||
namespace Content.Client.Cargo.UI
|
|
||||||
{
|
|
||||||
public class CargoConsoleMenu : SS14Window
|
|
||||||
{
|
|
||||||
public CargoConsoleBoundUserInterface Owner { get; private set; }
|
|
||||||
|
|
||||||
public event Action<ButtonEventArgs>? OnItemSelected;
|
|
||||||
public event Action<ButtonEventArgs>? OnOrderApproved;
|
|
||||||
public event Action<ButtonEventArgs>? OnOrderCanceled;
|
|
||||||
|
|
||||||
private readonly List<string> _categoryStrings = new();
|
|
||||||
|
|
||||||
private Label _accountNameLabel { get; set; }
|
|
||||||
private Label _pointsLabel { get; set; }
|
|
||||||
private Label _shuttleStatusLabel { get; set; }
|
|
||||||
private Label _shuttleCapacityLabel { get; set; }
|
|
||||||
private BoxContainer _requests { get; set; }
|
|
||||||
private BoxContainer _orders { get; set; }
|
|
||||||
private OptionButton _categories { get; set; }
|
|
||||||
private LineEdit _searchBar { get; set; }
|
|
||||||
|
|
||||||
public BoxContainer Products { get; set; }
|
|
||||||
public Button CallShuttleButton { get; set; }
|
|
||||||
public Button PermissionsButton { get; set; }
|
|
||||||
|
|
||||||
private string? _category = null;
|
|
||||||
|
|
||||||
public CargoConsoleMenu(CargoConsoleBoundUserInterface owner)
|
|
||||||
{
|
|
||||||
SetSize = MinSize = (400, 600);
|
|
||||||
IoCManager.InjectDependencies(this);
|
|
||||||
Owner = owner;
|
|
||||||
|
|
||||||
if (Owner.RequestOnly)
|
|
||||||
Title = Loc.GetString("cargo-console-menu-request-only-title");
|
|
||||||
else
|
|
||||||
Title = Loc.GetString("cargo-console-menu-title");
|
|
||||||
|
|
||||||
var rows = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Vertical
|
|
||||||
};
|
|
||||||
|
|
||||||
var accountName = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Horizontal
|
|
||||||
};
|
|
||||||
var accountNameLabel = new Label {
|
|
||||||
Text = Loc.GetString("cargo-console-menu-account-name-label") + " ",
|
|
||||||
StyleClasses = { StyleNano.StyleClassLabelKeyText }
|
|
||||||
};
|
|
||||||
_accountNameLabel = new Label {
|
|
||||||
Text = Loc.GetString("cargo-console-menu-account-name-none-text") //Owner.Bank.Account.Name
|
|
||||||
};
|
|
||||||
accountName.AddChild(accountNameLabel);
|
|
||||||
accountName.AddChild(_accountNameLabel);
|
|
||||||
rows.AddChild(accountName);
|
|
||||||
|
|
||||||
var points = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Horizontal
|
|
||||||
};
|
|
||||||
var pointsLabel = new Label
|
|
||||||
{
|
|
||||||
Text = Loc.GetString("cargo-console-menu-points-label") + " ",
|
|
||||||
StyleClasses = { StyleNano.StyleClassLabelKeyText }
|
|
||||||
};
|
|
||||||
_pointsLabel = new Label
|
|
||||||
{
|
|
||||||
Text = "0" //Owner.Bank.Account.Balance.ToString()
|
|
||||||
};
|
|
||||||
points.AddChild(pointsLabel);
|
|
||||||
points.AddChild(_pointsLabel);
|
|
||||||
rows.AddChild(points);
|
|
||||||
|
|
||||||
var shuttleStatus = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Horizontal
|
|
||||||
};
|
|
||||||
var shuttleStatusLabel = new Label
|
|
||||||
{
|
|
||||||
Text = Loc.GetString("cargo-console-menu-shuttle-status-label") + " ",
|
|
||||||
StyleClasses = { StyleNano.StyleClassLabelKeyText }
|
|
||||||
};
|
|
||||||
_shuttleStatusLabel = new Label
|
|
||||||
{
|
|
||||||
Text = Loc.GetString("cargo-console-menu-shuttle-status-away-text") // Shuttle.Status
|
|
||||||
};
|
|
||||||
shuttleStatus.AddChild(shuttleStatusLabel);
|
|
||||||
shuttleStatus.AddChild(_shuttleStatusLabel);
|
|
||||||
rows.AddChild(shuttleStatus);
|
|
||||||
|
|
||||||
var shuttleCapacity = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Horizontal
|
|
||||||
};
|
|
||||||
var shuttleCapacityLabel = new Label
|
|
||||||
{
|
|
||||||
Text = Loc.GetString("cargo-console-menu-order-capacity-label") + " ",
|
|
||||||
StyleClasses = { StyleNano.StyleClassLabelKeyText }
|
|
||||||
};
|
|
||||||
_shuttleCapacityLabel = new Label
|
|
||||||
{
|
|
||||||
Text = $"{0}/{20}"
|
|
||||||
};
|
|
||||||
shuttleCapacity.AddChild(shuttleCapacityLabel);
|
|
||||||
shuttleCapacity.AddChild(_shuttleCapacityLabel);
|
|
||||||
rows.AddChild(shuttleCapacity);
|
|
||||||
|
|
||||||
var buttons = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Horizontal
|
|
||||||
};
|
|
||||||
CallShuttleButton = new Button()
|
|
||||||
{
|
|
||||||
//Text = Loc.GetString("Call Shuttle"),
|
|
||||||
Text = Loc.GetString("cargo-console-menu-call-shuttle-button"), //Shuttle code pending
|
|
||||||
TextAlign = Label.AlignMode.Center,
|
|
||||||
HorizontalExpand = true
|
|
||||||
};
|
|
||||||
PermissionsButton = new Button()
|
|
||||||
{
|
|
||||||
Text = Loc.GetString("cargo-console-menu-permissions-button"),
|
|
||||||
TextAlign = Label.AlignMode.Center
|
|
||||||
};
|
|
||||||
buttons.AddChild(CallShuttleButton);
|
|
||||||
buttons.AddChild(PermissionsButton);
|
|
||||||
rows.AddChild(buttons);
|
|
||||||
|
|
||||||
var category = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Horizontal
|
|
||||||
};
|
|
||||||
_categories = new OptionButton
|
|
||||||
{
|
|
||||||
Prefix = Loc.GetString("cargo-console-menu-categories-label") + " ",
|
|
||||||
HorizontalExpand = true,
|
|
||||||
SizeFlagsStretchRatio = 1
|
|
||||||
};
|
|
||||||
_searchBar = new LineEdit
|
|
||||||
{
|
|
||||||
PlaceHolder = Loc.GetString("cargo-console-menu-search-bar-placeholder"),
|
|
||||||
HorizontalExpand = true,
|
|
||||||
SizeFlagsStretchRatio = 1
|
|
||||||
};
|
|
||||||
category.AddChild(_categories);
|
|
||||||
category.AddChild(_searchBar);
|
|
||||||
rows.AddChild(category);
|
|
||||||
|
|
||||||
var products = new ScrollContainer()
|
|
||||||
{
|
|
||||||
HorizontalExpand = true,
|
|
||||||
VerticalExpand = true,
|
|
||||||
SizeFlagsStretchRatio = 6
|
|
||||||
};
|
|
||||||
Products = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Vertical,
|
|
||||||
HorizontalExpand = true,
|
|
||||||
VerticalExpand = true
|
|
||||||
};
|
|
||||||
products.AddChild(Products);
|
|
||||||
rows.AddChild(products);
|
|
||||||
|
|
||||||
var requestsAndOrders = new PanelContainer
|
|
||||||
{
|
|
||||||
VerticalExpand = true,
|
|
||||||
SizeFlagsStretchRatio = 6,
|
|
||||||
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Black }
|
|
||||||
};
|
|
||||||
var orderScrollBox = new ScrollContainer
|
|
||||||
{
|
|
||||||
VerticalExpand = true
|
|
||||||
};
|
|
||||||
var rAndOVBox = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Vertical
|
|
||||||
};
|
|
||||||
var requestsLabel = new Label { Text = Loc.GetString("cargo-console-menu-requests-label") };
|
|
||||||
_requests = new BoxContainer // replace with scroll box so that approval buttons can be added
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Vertical,
|
|
||||||
StyleClasses = { "transparentItemList" },
|
|
||||||
VerticalExpand = true,
|
|
||||||
SizeFlagsStretchRatio = 1,
|
|
||||||
};
|
|
||||||
var ordersLabel = new Label { Text = Loc.GetString("cargo-console-menu-orders-label") };
|
|
||||||
_orders = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Vertical,
|
|
||||||
StyleClasses = { "transparentItemList" },
|
|
||||||
VerticalExpand = true,
|
|
||||||
SizeFlagsStretchRatio = 1,
|
|
||||||
};
|
|
||||||
rAndOVBox.AddChild(requestsLabel);
|
|
||||||
rAndOVBox.AddChild(_requests);
|
|
||||||
rAndOVBox.AddChild(ordersLabel);
|
|
||||||
rAndOVBox.AddChild(_orders);
|
|
||||||
orderScrollBox.AddChild(rAndOVBox);
|
|
||||||
requestsAndOrders.AddChild(orderScrollBox);
|
|
||||||
rows.AddChild(requestsAndOrders);
|
|
||||||
|
|
||||||
rows.AddChild(new TextureButton
|
|
||||||
{
|
|
||||||
VerticalExpand = true,
|
|
||||||
});
|
|
||||||
Contents.AddChild(rows);
|
|
||||||
|
|
||||||
CallShuttleButton.OnPressed += OnCallShuttleButtonPressed;
|
|
||||||
_searchBar.OnTextChanged += OnSearchBarTextChanged;
|
|
||||||
_categories.OnItemSelected += OnCategoryItemSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCallShuttleButtonPressed(ButtonEventArgs args)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCategoryItemSelected(OptionButton.ItemSelectedEventArgs args)
|
|
||||||
{
|
|
||||||
SetCategoryText(args.Id);
|
|
||||||
PopulateProducts();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnSearchBarTextChanged(LineEdit.LineEditEventArgs args)
|
|
||||||
{
|
|
||||||
PopulateProducts();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetCategoryText(int id)
|
|
||||||
{
|
|
||||||
if (id == 0)
|
|
||||||
_category = null;
|
|
||||||
else
|
|
||||||
_category = _categoryStrings[id];
|
|
||||||
_categories.SelectId(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Populates the list of products that will actually be shown, using the current filters.
|
|
||||||
/// </summary>
|
|
||||||
public void PopulateProducts()
|
|
||||||
{
|
|
||||||
Products.RemoveAllChildren();
|
|
||||||
|
|
||||||
if (Owner.Market == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var search = _searchBar.Text.Trim().ToLowerInvariant();
|
|
||||||
foreach (var prototype in Owner.Market.Products)
|
|
||||||
{
|
|
||||||
// if no search or category
|
|
||||||
// else if search
|
|
||||||
// else if category and not search
|
|
||||||
if ((search.Length == 0 && _category == null) ||
|
|
||||||
(search.Length != 0 && prototype.Name.ToLowerInvariant().Contains(search)) ||
|
|
||||||
(search.Length == 0 && _category != null && prototype.Category.Equals(_category)))
|
|
||||||
{
|
|
||||||
var button = new CargoProductRow();
|
|
||||||
button.Product = prototype;
|
|
||||||
button.ProductName.Text = prototype.Name;
|
|
||||||
button.PointCost.Text = prototype.PointCost.ToString();
|
|
||||||
button.Icon.Texture = prototype.Icon.Frame0();
|
|
||||||
button.MainButton.OnPressed += (args) =>
|
|
||||||
{
|
|
||||||
OnItemSelected?.Invoke(args);
|
|
||||||
};
|
|
||||||
Products.AddChild(button);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Populates the list of products that will actually be shown, using the current filters.
|
|
||||||
/// </summary>
|
|
||||||
public void PopulateCategories()
|
|
||||||
{
|
|
||||||
_categoryStrings.Clear();
|
|
||||||
_categories.Clear();
|
|
||||||
|
|
||||||
if (Owner.Market == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_categoryStrings.Add(Loc.GetString("cargo-console-menu-populate-categories-all-text"));
|
|
||||||
|
|
||||||
var search = _searchBar.Text.Trim().ToLowerInvariant();
|
|
||||||
foreach (var prototype in Owner.Market.Products)
|
|
||||||
{
|
|
||||||
if (!_categoryStrings.Contains(prototype.Category))
|
|
||||||
{
|
|
||||||
_categoryStrings.Add(Loc.GetString(prototype.Category));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_categoryStrings.Sort();
|
|
||||||
foreach (var str in _categoryStrings)
|
|
||||||
{
|
|
||||||
_categories.AddItem(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Populates the list of orders and requests.
|
|
||||||
/// </summary>
|
|
||||||
public void PopulateOrders()
|
|
||||||
{
|
|
||||||
_orders.RemoveAllChildren();
|
|
||||||
_requests.RemoveAllChildren();
|
|
||||||
|
|
||||||
if (Owner.Orders == null || Owner.Market == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var order in Owner.Orders.Orders)
|
|
||||||
{
|
|
||||||
var row = new CargoOrderRow
|
|
||||||
{
|
|
||||||
Order = order,
|
|
||||||
Icon = { Texture = Owner.Market.GetProduct(order.ProductId)?.Icon.Frame0() },
|
|
||||||
ProductName =
|
|
||||||
{
|
|
||||||
Text = Loc.GetString(
|
|
||||||
"cargo-console-menu-populate-orders-cargo-order-row-product-name-text",
|
|
||||||
("productName", Owner.Market.GetProduct(order.ProductId)?.Name!),
|
|
||||||
("orderAmount", order.Amount),
|
|
||||||
("orderRequester", order.Requester))
|
|
||||||
},
|
|
||||||
Description = {Text = Loc.GetString("cargo-console-menu-order-reason-description",
|
|
||||||
("reason", order.Reason))}
|
|
||||||
};
|
|
||||||
row.Cancel.OnPressed += (args) => { OnOrderCanceled?.Invoke(args); };
|
|
||||||
if (order.Approved)
|
|
||||||
{
|
|
||||||
row.Approve.Visible = false;
|
|
||||||
row.Cancel.Visible = false;
|
|
||||||
_orders.AddChild(row);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Owner.RequestOnly)
|
|
||||||
row.Approve.Visible = false;
|
|
||||||
else
|
|
||||||
row.Approve.OnPressed += (args) => { OnOrderApproved?.Invoke(args); };
|
|
||||||
_requests.AddChild(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Populate()
|
|
||||||
{
|
|
||||||
PopulateProducts();
|
|
||||||
PopulateCategories();
|
|
||||||
PopulateOrders();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateCargoCapacity()
|
|
||||||
{
|
|
||||||
_shuttleCapacityLabel.Text = $"{Owner.ShuttleCapacity.CurrentCapacity}/{Owner.ShuttleCapacity.MaxCapacity}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateBankData()
|
|
||||||
{
|
|
||||||
_accountNameLabel.Text = Owner.BankName;
|
|
||||||
_pointsLabel.Text = Owner.BankBalance.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Show/Hide Call Shuttle button and Approve buttons
|
|
||||||
/// </summary>
|
|
||||||
public void UpdateRequestOnly()
|
|
||||||
{
|
|
||||||
CallShuttleButton.Visible = !Owner.RequestOnly;
|
|
||||||
foreach (CargoOrderRow row in _requests.Children)
|
|
||||||
{
|
|
||||||
row.Approve.Visible = !Owner.RequestOnly;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class CargoProductRow : PanelContainer
|
|
||||||
{
|
|
||||||
public CargoProductPrototype? Product { get; set; }
|
|
||||||
public TextureRect Icon { get; private set; }
|
|
||||||
public Button MainButton { get; private set; }
|
|
||||||
public Label ProductName { get; private set; }
|
|
||||||
public Label PointCost { get; private set; }
|
|
||||||
|
|
||||||
public CargoProductRow()
|
|
||||||
{
|
|
||||||
HorizontalExpand = true;
|
|
||||||
|
|
||||||
MainButton = new Button
|
|
||||||
{
|
|
||||||
HorizontalExpand = true,
|
|
||||||
VerticalExpand = true
|
|
||||||
};
|
|
||||||
AddChild(MainButton);
|
|
||||||
|
|
||||||
var hBox = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Horizontal,
|
|
||||||
HorizontalExpand = true
|
|
||||||
};
|
|
||||||
|
|
||||||
Icon = new TextureRect
|
|
||||||
{
|
|
||||||
MinSize = new Vector2(32.0f, 32.0f),
|
|
||||||
RectClipContent = true
|
|
||||||
};
|
|
||||||
hBox.AddChild(Icon);
|
|
||||||
|
|
||||||
ProductName = new Label
|
|
||||||
{
|
|
||||||
HorizontalExpand = true
|
|
||||||
};
|
|
||||||
hBox.AddChild(ProductName);
|
|
||||||
|
|
||||||
var panel = new PanelContainer
|
|
||||||
{
|
|
||||||
PanelOverride = new StyleBoxFlat { BackgroundColor = new Color(37, 37, 42) },
|
|
||||||
};
|
|
||||||
PointCost = new Label
|
|
||||||
{
|
|
||||||
MinSize = new Vector2(40.0f, 32.0f),
|
|
||||||
Align = Label.AlignMode.Right
|
|
||||||
};
|
|
||||||
panel.AddChild(PointCost);
|
|
||||||
hBox.AddChild(panel);
|
|
||||||
|
|
||||||
AddChild(hBox);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class CargoOrderRow : PanelContainer
|
|
||||||
{
|
|
||||||
public CargoOrderData? Order { get; set; }
|
|
||||||
public TextureRect Icon { get; private set; }
|
|
||||||
public Label ProductName { get; private set; }
|
|
||||||
public Label Description { get; private set; }
|
|
||||||
public BaseButton Approve { get; private set; }
|
|
||||||
public BaseButton Cancel { get; private set; }
|
|
||||||
|
|
||||||
public CargoOrderRow()
|
|
||||||
{
|
|
||||||
HorizontalExpand = true;
|
|
||||||
|
|
||||||
var hBox = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Horizontal,
|
|
||||||
HorizontalExpand = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
Icon = new TextureRect
|
|
||||||
{
|
|
||||||
MinSize = new Vector2(32.0f, 32.0f),
|
|
||||||
RectClipContent = true
|
|
||||||
};
|
|
||||||
hBox.AddChild(Icon);
|
|
||||||
|
|
||||||
var vBox = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Vertical,
|
|
||||||
HorizontalExpand = true,
|
|
||||||
VerticalExpand = true
|
|
||||||
};
|
|
||||||
ProductName = new Label
|
|
||||||
{
|
|
||||||
HorizontalExpand = true,
|
|
||||||
StyleClasses = { StyleNano.StyleClassLabelSubText },
|
|
||||||
ClipText = true
|
|
||||||
};
|
|
||||||
Description = new Label
|
|
||||||
{
|
|
||||||
HorizontalExpand = true,
|
|
||||||
StyleClasses = { StyleNano.StyleClassLabelSubText },
|
|
||||||
ClipText = true
|
|
||||||
};
|
|
||||||
vBox.AddChild(ProductName);
|
|
||||||
vBox.AddChild(Description);
|
|
||||||
hBox.AddChild(vBox);
|
|
||||||
|
|
||||||
Approve = new Button
|
|
||||||
{
|
|
||||||
Text = Loc.GetString("cargo-console-menu-cargo-order-row-approve-button"),
|
|
||||||
StyleClasses = { StyleNano.StyleClassLabelSubText }
|
|
||||||
};
|
|
||||||
hBox.AddChild(Approve);
|
|
||||||
|
|
||||||
Cancel = new Button
|
|
||||||
{
|
|
||||||
Text = Loc.GetString("cargo-console-menu-cargo-order-row-cancel-button"),
|
|
||||||
StyleClasses = { StyleNano.StyleClassLabelSubText }
|
|
||||||
};
|
|
||||||
hBox.AddChild(Cancel);
|
|
||||||
|
|
||||||
AddChild(hBox);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
82
Content.Client/Cargo/UI/CargoConsoleMenu.xaml
Normal file
82
Content.Client/Cargo/UI/CargoConsoleMenu.xaml
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<SS14Window xmlns="https://spacestation14.io"
|
||||||
|
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
|
||||||
|
SetSize="400 600"
|
||||||
|
MinSize="400 600">
|
||||||
|
<BoxContainer Orientation="Vertical" Name="rows"> <!-- TODO: remove name -->
|
||||||
|
<BoxContainer Orientation="Horizontal">
|
||||||
|
<Label Text="{Loc 'cargo-console-menu-account-name-label'}"
|
||||||
|
StyleClasses="LabelKeyText" />
|
||||||
|
<Label Name="AccountNameLabel"
|
||||||
|
Text="{Loc 'cargo-console-menu-account-name-none-text'}" />
|
||||||
|
</BoxContainer>
|
||||||
|
<BoxContainer Orientation="Horizontal">
|
||||||
|
<Label Text="{Loc 'cargo-console-menu-points-label'}"
|
||||||
|
StyleClasses="LabelKeyText" />
|
||||||
|
<Label Name="PointsLabel"
|
||||||
|
Text="0" />
|
||||||
|
</BoxContainer>
|
||||||
|
<BoxContainer Orientation="Horizontal">
|
||||||
|
<Label Text="{Loc 'cargo-console-menu-shuttle-status-label'}"
|
||||||
|
StyleClasses="LabelKeyText" />
|
||||||
|
<Label Name="ShuttleStatusLabel"
|
||||||
|
Text="{Loc 'cargo-console-menu-shuttle-status-away-text'}" />
|
||||||
|
</BoxContainer>
|
||||||
|
<BoxContainer Orientation="Horizontal">
|
||||||
|
<Label Text="{Loc 'cargo-console-menu-order-capacity-label'}"
|
||||||
|
StyleClasses="LabelKeyText" />
|
||||||
|
<Label Name="ShuttleCapacityLabel"
|
||||||
|
Text="0/20" />
|
||||||
|
</BoxContainer>
|
||||||
|
<BoxContainer Orientation="Horizontal">
|
||||||
|
<Button Name="CallShuttleButtonProtected"
|
||||||
|
Text="{Loc 'cargo-console-menu-call-shuttle-button'}"
|
||||||
|
TextAlign="Center"
|
||||||
|
HorizontalExpand="True"/>
|
||||||
|
<Button Name="PermissionsButton"
|
||||||
|
Text="{Loc 'cargo-console-menu-permissions-button'}"
|
||||||
|
TextAlign="Center" />
|
||||||
|
</BoxContainer>
|
||||||
|
<BoxContainer Orientation="Horizontal">
|
||||||
|
<OptionButton Name="Categories"
|
||||||
|
Prefix="{Loc 'cargo-console-menu-categories-label'}"
|
||||||
|
HorizontalExpand="True" />
|
||||||
|
<LineEdit Name="SearchBar"
|
||||||
|
PlaceHolder="{Loc 'cargo-console-menu-search-bar-placeholder'}"
|
||||||
|
HorizontalExpand="True" />
|
||||||
|
</BoxContainer>
|
||||||
|
<ScrollContainer HorizontalExpand="True"
|
||||||
|
VerticalExpand="True"
|
||||||
|
SizeFlagsStretchRatio="6">
|
||||||
|
<BoxContainer Name="Products"
|
||||||
|
Orientation="Vertical"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
VerticalExpand="True">
|
||||||
|
<!-- Products get added here by code -->
|
||||||
|
</BoxContainer>
|
||||||
|
</ScrollContainer>
|
||||||
|
<PanelContainer VerticalExpand="True"
|
||||||
|
SizeFlagsStretchRatio="6">
|
||||||
|
<PanelContainer.PanelOverride>
|
||||||
|
<gfx:StyleBoxFlat BackgroundColor="#000000" />
|
||||||
|
</PanelContainer.PanelOverride>
|
||||||
|
<ScrollContainer VerticalExpand="True">
|
||||||
|
<BoxContainer Orientation="Vertical">
|
||||||
|
<Label Text="{Loc 'cargo-console-menu-requests-label'}" />
|
||||||
|
<BoxContainer Name="Requests"
|
||||||
|
Orientation="Vertical"
|
||||||
|
VerticalExpand="True">
|
||||||
|
<!-- Requests are added here by code -->
|
||||||
|
</BoxContainer>
|
||||||
|
<Label Text="{Loc 'cargo-console-menu-orders-label'}" />
|
||||||
|
<BoxContainer Name="Orders"
|
||||||
|
Orientation="Vertical"
|
||||||
|
StyleClasses="transparentItemList"
|
||||||
|
VerticalExpand="True">
|
||||||
|
<!-- Orders are added here by code -->
|
||||||
|
</BoxContainer>
|
||||||
|
</BoxContainer>
|
||||||
|
</ScrollContainer>
|
||||||
|
</PanelContainer>
|
||||||
|
<TextureButton VerticalExpand="True" />
|
||||||
|
</BoxContainer>
|
||||||
|
</SS14Window>
|
||||||
214
Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs
Normal file
214
Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Content.Client.Stylesheets;
|
||||||
|
using Content.Shared.Cargo;
|
||||||
|
using Robust.Client.AutoGenerated;
|
||||||
|
using Robust.Client.Graphics;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
using Robust.Client.Utility;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Localization;
|
||||||
|
using Robust.Shared.Maths;
|
||||||
|
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||||
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
||||||
|
|
||||||
|
namespace Content.Client.Cargo.UI
|
||||||
|
{
|
||||||
|
[GenerateTypedNameReferences]
|
||||||
|
public partial class CargoConsoleMenu : SS14Window
|
||||||
|
{
|
||||||
|
public CargoConsoleBoundUserInterface Owner { get; private set; }
|
||||||
|
|
||||||
|
public event Action<ButtonEventArgs>? OnItemSelected;
|
||||||
|
public event Action<ButtonEventArgs>? OnOrderApproved;
|
||||||
|
public event Action<ButtonEventArgs>? OnOrderCanceled;
|
||||||
|
|
||||||
|
public Button CallShuttleButton => CallShuttleButtonProtected;
|
||||||
|
|
||||||
|
private readonly List<string> _categoryStrings = new();
|
||||||
|
private string? _category;
|
||||||
|
|
||||||
|
public CargoConsoleMenu(CargoConsoleBoundUserInterface owner)
|
||||||
|
{
|
||||||
|
RobustXamlLoader.Load(this);
|
||||||
|
IoCManager.InjectDependencies(this);
|
||||||
|
Owner = owner;
|
||||||
|
|
||||||
|
Title = Loc.GetString(Owner.RequestOnly
|
||||||
|
? "cargo-console-menu-request-only-title"
|
||||||
|
: "cargo-console-menu-title");
|
||||||
|
|
||||||
|
CallShuttleButton.OnPressed += OnCallShuttleButtonPressed;
|
||||||
|
SearchBar.OnTextChanged += OnSearchBarTextChanged;
|
||||||
|
Categories.OnItemSelected += OnCategoryItemSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCallShuttleButtonPressed(ButtonEventArgs args)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCategoryItemSelected(OptionButton.ItemSelectedEventArgs args)
|
||||||
|
{
|
||||||
|
SetCategoryText(args.Id);
|
||||||
|
PopulateProducts();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSearchBarTextChanged(LineEdit.LineEditEventArgs args)
|
||||||
|
{
|
||||||
|
PopulateProducts();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetCategoryText(int id)
|
||||||
|
{
|
||||||
|
_category = id == 0 ? null : _categoryStrings[id];
|
||||||
|
Categories.SelectId(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Populates the list of products that will actually be shown, using the current filters.
|
||||||
|
/// </summary>
|
||||||
|
public void PopulateProducts()
|
||||||
|
{
|
||||||
|
Products.RemoveAllChildren();
|
||||||
|
|
||||||
|
if (Owner.Market == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var search = SearchBar.Text.Trim().ToLowerInvariant();
|
||||||
|
foreach (var prototype in Owner.Market.Products)
|
||||||
|
{
|
||||||
|
// if no search or category
|
||||||
|
// else if search
|
||||||
|
// else if category and not search
|
||||||
|
if (search.Length == 0 && _category == null ||
|
||||||
|
search.Length != 0 && prototype.Name.ToLowerInvariant().Contains(search) ||
|
||||||
|
search.Length == 0 && _category != null && prototype.Category.Equals(_category))
|
||||||
|
{
|
||||||
|
var button = new CargoProductRow
|
||||||
|
{
|
||||||
|
Product = prototype,
|
||||||
|
ProductName = { Text = prototype.Name },
|
||||||
|
PointCost = { Text = prototype.PointCost.ToString() },
|
||||||
|
Icon = { Texture = prototype.Icon.Frame0() },
|
||||||
|
};
|
||||||
|
button.MainButton.OnPressed += args =>
|
||||||
|
{
|
||||||
|
OnItemSelected?.Invoke(args);
|
||||||
|
};
|
||||||
|
Products.AddChild(button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Populates the list of products that will actually be shown, using the current filters.
|
||||||
|
/// </summary>
|
||||||
|
public void PopulateCategories()
|
||||||
|
{
|
||||||
|
_categoryStrings.Clear();
|
||||||
|
Categories.Clear();
|
||||||
|
|
||||||
|
if (Owner.Market == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_categoryStrings.Add(Loc.GetString("cargo-console-menu-populate-categories-all-text"));
|
||||||
|
|
||||||
|
foreach (var prototype in Owner.Market.Products)
|
||||||
|
{
|
||||||
|
if (!_categoryStrings.Contains(prototype.Category))
|
||||||
|
{
|
||||||
|
_categoryStrings.Add(Loc.GetString(prototype.Category));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_categoryStrings.Sort();
|
||||||
|
foreach (var str in _categoryStrings)
|
||||||
|
{
|
||||||
|
Categories.AddItem(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Populates the list of orders and requests.
|
||||||
|
/// </summary>
|
||||||
|
public void PopulateOrders()
|
||||||
|
{
|
||||||
|
Orders.RemoveAllChildren();
|
||||||
|
Requests.RemoveAllChildren();
|
||||||
|
|
||||||
|
if (Owner.Orders == null || Owner.Market == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var order in Owner.Orders.Orders)
|
||||||
|
{
|
||||||
|
var row = new CargoOrderRow
|
||||||
|
{
|
||||||
|
Order = order,
|
||||||
|
Icon = { Texture = Owner.Market.GetProduct(order.ProductId)?.Icon.Frame0() },
|
||||||
|
ProductName =
|
||||||
|
{
|
||||||
|
Text = Loc.GetString(
|
||||||
|
"cargo-console-menu-populate-orders-cargo-order-row-product-name-text",
|
||||||
|
("productName", Owner.Market.GetProduct(order.ProductId)?.Name!),
|
||||||
|
("orderAmount", order.Amount),
|
||||||
|
("orderRequester", order.Requester))
|
||||||
|
},
|
||||||
|
Description = {Text = Loc.GetString("cargo-console-menu-order-reason-description",
|
||||||
|
("reason", order.Reason))}
|
||||||
|
};
|
||||||
|
row.Cancel.OnPressed += (args) => { OnOrderCanceled?.Invoke(args); };
|
||||||
|
if (order.Approved)
|
||||||
|
{
|
||||||
|
row.Approve.Visible = false;
|
||||||
|
row.Cancel.Visible = false;
|
||||||
|
Orders.AddChild(row);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Owner.RequestOnly)
|
||||||
|
row.Approve.Visible = false;
|
||||||
|
else
|
||||||
|
row.Approve.OnPressed += (args) => { OnOrderApproved?.Invoke(args); };
|
||||||
|
Requests.AddChild(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Populate()
|
||||||
|
{
|
||||||
|
PopulateProducts();
|
||||||
|
PopulateCategories();
|
||||||
|
PopulateOrders();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateCargoCapacity()
|
||||||
|
{
|
||||||
|
ShuttleCapacityLabel.Text = $"{Owner.ShuttleCapacity.CurrentCapacity}/{Owner.ShuttleCapacity.MaxCapacity}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateBankData()
|
||||||
|
{
|
||||||
|
AccountNameLabel.Text = Owner.BankName;
|
||||||
|
PointsLabel.Text = Owner.BankBalance.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show/Hide Call Shuttle button and Approve buttons
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateRequestOnly()
|
||||||
|
{
|
||||||
|
CallShuttleButton.Visible = !Owner.RequestOnly;
|
||||||
|
foreach (CargoOrderRow row in Requests.Children)
|
||||||
|
{
|
||||||
|
row.Approve.Visible = !Owner.RequestOnly;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Robust.Client.UserInterface.Controls;
|
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
|
||||||
|
|
||||||
namespace Content.Client.Cargo.UI
|
|
||||||
{
|
|
||||||
class CargoConsoleOrderMenu : SS14Window
|
|
||||||
{
|
|
||||||
public LineEdit Requester { get; set; }
|
|
||||||
public LineEdit Reason { get; set; }
|
|
||||||
public SpinBox Amount { get; set; }
|
|
||||||
public Button SubmitButton { get; set; }
|
|
||||||
|
|
||||||
public CargoConsoleOrderMenu()
|
|
||||||
{
|
|
||||||
IoCManager.InjectDependencies(this);
|
|
||||||
|
|
||||||
Title = Loc.GetString("cargo-console-order-menu-title");
|
|
||||||
|
|
||||||
var vBox = new BoxContainer
|
|
||||||
{
|
|
||||||
Orientation = LayoutOrientation.Vertical
|
|
||||||
};
|
|
||||||
var gridContainer = new GridContainer { Columns = 2 };
|
|
||||||
|
|
||||||
var requesterLabel = new Label { Text = Loc.GetString("cargo-console-order-menu-requester-label") };
|
|
||||||
Requester = new LineEdit();
|
|
||||||
gridContainer.AddChild(requesterLabel);
|
|
||||||
gridContainer.AddChild(Requester);
|
|
||||||
|
|
||||||
var reasonLabel = new Label { Text = Loc.GetString("cargo-console-order-menu-reason-label") };
|
|
||||||
Reason = new LineEdit();
|
|
||||||
gridContainer.AddChild(reasonLabel);
|
|
||||||
gridContainer.AddChild(Reason);
|
|
||||||
|
|
||||||
var amountLabel = new Label { Text = Loc.GetString("cargo-console-order-menu-amount-label") };
|
|
||||||
Amount = new SpinBox
|
|
||||||
{
|
|
||||||
HorizontalExpand = true,
|
|
||||||
Value = 1
|
|
||||||
};
|
|
||||||
Amount.SetButtons(new List<int>() { -3, -2, -1 }, new List<int>() { 1, 2, 3 });
|
|
||||||
Amount.IsValid = (n) => {
|
|
||||||
return (n > 0);
|
|
||||||
};
|
|
||||||
gridContainer.AddChild(amountLabel);
|
|
||||||
gridContainer.AddChild(Amount);
|
|
||||||
|
|
||||||
vBox.AddChild(gridContainer);
|
|
||||||
|
|
||||||
SubmitButton = new Button()
|
|
||||||
{
|
|
||||||
Text = Loc.GetString("cargo-console-order-menu-submit-button"),
|
|
||||||
TextAlign = Label.AlignMode.Center,
|
|
||||||
};
|
|
||||||
vBox.AddChild(SubmitButton);
|
|
||||||
|
|
||||||
Contents.AddChild(vBox);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
18
Content.Client/Cargo/UI/CargoConsoleOrderMenu.xaml
Normal file
18
Content.Client/Cargo/UI/CargoConsoleOrderMenu.xaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<SS14Window xmlns="https://spacestation14.io"
|
||||||
|
Title="{Loc 'cargo-console-order-menu-title'}">
|
||||||
|
<BoxContainer Orientation="Vertical">
|
||||||
|
<GridContainer Columns="2">
|
||||||
|
<Label Text="{Loc 'cargo-console-order-menu-requester-label'}" />
|
||||||
|
<LineEdit Name="RequesterProtected" />
|
||||||
|
<Label Text="{Loc 'cargo-console-order-menu-reason-label'}" />
|
||||||
|
<LineEdit Name="ReasonProtected" />
|
||||||
|
<Label Text="{Loc 'cargo-console-order-menu-amount-label'}" />
|
||||||
|
<SpinBox Name="AmountProtected"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
Value="1" />
|
||||||
|
</GridContainer>
|
||||||
|
<Button Name="SubmitButtonProtected"
|
||||||
|
Text="{Loc 'cargo-console-order-menu-submit-button'}"
|
||||||
|
TextAlign="Center" />
|
||||||
|
</BoxContainer>
|
||||||
|
</SS14Window>
|
||||||
27
Content.Client/Cargo/UI/CargoConsoleOrderMenu.xaml.cs
Normal file
27
Content.Client/Cargo/UI/CargoConsoleOrderMenu.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Robust.Client.AutoGenerated;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
|
namespace Content.Client.Cargo.UI
|
||||||
|
{
|
||||||
|
[GenerateTypedNameReferences]
|
||||||
|
partial class CargoConsoleOrderMenu : SS14Window
|
||||||
|
{
|
||||||
|
public LineEdit Requester => RequesterProtected;
|
||||||
|
public LineEdit Reason => ReasonProtected;
|
||||||
|
public SpinBox Amount => AmountProtected;
|
||||||
|
public Button SubmitButton => SubmitButtonProtected;
|
||||||
|
|
||||||
|
public CargoConsoleOrderMenu()
|
||||||
|
{
|
||||||
|
RobustXamlLoader.Load(this);
|
||||||
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
|
Amount.SetButtons(new List<int> { -3, -2, -1 }, new List<int> { 1, 2, 3 });
|
||||||
|
Amount.IsValid = n => n > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Content.Client/Cargo/UI/CargoOrderRow.xaml
Normal file
27
Content.Client/Cargo/UI/CargoOrderRow.xaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<PanelContainer xmlns="https://spacestation14.io"
|
||||||
|
HorizontalExpand="True">
|
||||||
|
<BoxContainer Orientation="Horizontal"
|
||||||
|
HorizontalExpand="True">
|
||||||
|
<TextureRect Name="IconProtected"
|
||||||
|
MinSize="32 32"
|
||||||
|
RectClipContent="True" />
|
||||||
|
<BoxContainer Orientation="Vertical"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
VerticalExpand="True">
|
||||||
|
<Label Name="ProductNameProtected"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
StyleClasses="LabelSubText"
|
||||||
|
ClipText="True" />
|
||||||
|
<Label Name="DescriptionProtected"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
StyleClasses="LabelSubText"
|
||||||
|
ClipText="True" />
|
||||||
|
</BoxContainer>
|
||||||
|
<Button Name="ApproveProtected"
|
||||||
|
Text="{Loc 'cargo-console-menu-cargo-order-row-approve-button'}"
|
||||||
|
StyleClasses="LabelSubText" />
|
||||||
|
<Button Name="CancelProtected"
|
||||||
|
Text="{Loc 'cargo-console-menu-cargo-order-row-cancel-button'}"
|
||||||
|
StyleClasses="LabelSubText" />
|
||||||
|
</BoxContainer>
|
||||||
|
</PanelContainer>
|
||||||
23
Content.Client/Cargo/UI/CargoOrderRow.xaml.cs
Normal file
23
Content.Client/Cargo/UI/CargoOrderRow.xaml.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using Content.Shared.Cargo;
|
||||||
|
using Robust.Client.AutoGenerated;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
|
||||||
|
namespace Content.Client.Cargo.UI
|
||||||
|
{
|
||||||
|
[GenerateTypedNameReferences]
|
||||||
|
public partial class CargoOrderRow : PanelContainer
|
||||||
|
{
|
||||||
|
public CargoOrderData? Order { get; set; }
|
||||||
|
public TextureRect Icon => IconProtected;
|
||||||
|
public Label ProductName => ProductNameProtected;
|
||||||
|
public Label Description => DescriptionProtected;
|
||||||
|
public Button Approve => ApproveProtected;
|
||||||
|
public Button Cancel => CancelProtected;
|
||||||
|
|
||||||
|
public CargoOrderRow()
|
||||||
|
{
|
||||||
|
RobustXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Content.Client/Cargo/UI/CargoProductRow.xaml
Normal file
23
Content.Client/Cargo/UI/CargoProductRow.xaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<PanelContainer xmlns="https://spacestation14.io"
|
||||||
|
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
|
||||||
|
HorizontalExpand="True">
|
||||||
|
<Button Name="MainButtonProtected"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
VerticalExpand="True" />
|
||||||
|
<BoxContainer Orientation="Horizontal"
|
||||||
|
HorizontalExpand="True">
|
||||||
|
<TextureRect Name="IconProtected"
|
||||||
|
MinSize="32 32"
|
||||||
|
RectClipContent="True" />
|
||||||
|
<Label Name="ProductNameProtected"
|
||||||
|
HorizontalExpand="True" />
|
||||||
|
<PanelContainer>
|
||||||
|
<PanelContainer.PanelOverride>
|
||||||
|
<gfx:StyleBoxFlat BackgroundColor="#25252A" />
|
||||||
|
</PanelContainer.PanelOverride>
|
||||||
|
<Label Name="PointCostProtected"
|
||||||
|
MinSize="40 32"
|
||||||
|
Align="Right" />
|
||||||
|
</PanelContainer>
|
||||||
|
</BoxContainer>
|
||||||
|
</PanelContainer>
|
||||||
22
Content.Client/Cargo/UI/CargoProductRow.xaml.cs
Normal file
22
Content.Client/Cargo/UI/CargoProductRow.xaml.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Content.Shared.Cargo;
|
||||||
|
using Robust.Client.AutoGenerated;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
|
||||||
|
namespace Content.Client.Cargo.UI
|
||||||
|
{
|
||||||
|
[GenerateTypedNameReferences]
|
||||||
|
public partial class CargoProductRow : PanelContainer
|
||||||
|
{
|
||||||
|
public CargoProductPrototype? Product { get; set; }
|
||||||
|
public TextureRect Icon => IconProtected;
|
||||||
|
public Button MainButton => MainButtonProtected;
|
||||||
|
public Label ProductName => ProductNameProtected;
|
||||||
|
public Label PointCost => PointCostProtected;
|
||||||
|
|
||||||
|
public CargoProductRow()
|
||||||
|
{
|
||||||
|
RobustXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,8 +9,8 @@ namespace Content.Client.Cargo.UI
|
|||||||
{
|
{
|
||||||
private readonly ItemList _accounts;
|
private readonly ItemList _accounts;
|
||||||
private int _accountCount;
|
private int _accountCount;
|
||||||
private string[] _accountNames = new string[] { };
|
private string[] _accountNames = System.Array.Empty<string>();
|
||||||
private int[] _accountIds = new int[] { };
|
private int[] _accountIds = System.Array.Empty<int>();
|
||||||
private int _selectedAccountId = -1;
|
private int _selectedAccountId = -1;
|
||||||
|
|
||||||
public GalacticBankSelectionMenu(CargoConsoleBoundUserInterface owner)
|
public GalacticBankSelectionMenu(CargoConsoleBoundUserInterface owner)
|
||||||
@@ -20,7 +20,7 @@ namespace Content.Client.Cargo.UI
|
|||||||
|
|
||||||
Title = Loc.GetString("galactic-bank-selection-menu-title");
|
Title = Loc.GetString("galactic-bank-selection-menu-title");
|
||||||
|
|
||||||
_accounts = new ItemList() { SelectMode = ItemList.ItemListSelectMode.Single };
|
_accounts = new ItemList { SelectMode = ItemList.ItemListSelectMode.Single };
|
||||||
|
|
||||||
Contents.AddChild(_accounts);
|
Contents.AddChild(_accounts);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
## UI
|
## UI
|
||||||
cargo-console-menu-request-only-title = Cargo Request Console
|
cargo-console-menu-request-only-title = Cargo Request Console
|
||||||
cargo-console-menu-title = Cargo Shuttle Console
|
cargo-console-menu-title = Cargo Shuttle Console
|
||||||
cargo-console-menu-account-name-label = Account Name:
|
cargo-console-menu-account-name-label = Account Name:{" "}
|
||||||
cargo-console-menu-account-name-none-text = None
|
cargo-console-menu-account-name-none-text = None
|
||||||
cargo-console-menu-points-label = Points:
|
cargo-console-menu-points-label = Points:{" "}
|
||||||
cargo-console-menu-shuttle-status-label = Shuttle Status:
|
cargo-console-menu-shuttle-status-label = Shuttle Status:{" "}
|
||||||
cargo-console-menu-shuttle-status-away-text = Away
|
cargo-console-menu-shuttle-status-away-text = Away
|
||||||
cargo-console-menu-order-capacity-label = Order Capacity:
|
cargo-console-menu-order-capacity-label = Order Capacity:{" "}
|
||||||
cargo-console-menu-call-shuttle-button = Activate Telepad
|
cargo-console-menu-call-shuttle-button = Activate Telepad
|
||||||
cargo-console-menu-permissions-button = Permissions
|
cargo-console-menu-permissions-button = Permissions
|
||||||
cargo-console-menu-categories-label = Categories:
|
cargo-console-menu-categories-label = Categories:{" "}
|
||||||
cargo-console-menu-search-bar-placeholder = Search
|
cargo-console-menu-search-bar-placeholder = Search
|
||||||
cargo-console-menu-requests-label = Requests
|
cargo-console-menu-requests-label = Requests
|
||||||
cargo-console-menu-orders-label = Orders
|
cargo-console-menu-orders-label = Orders
|
||||||
|
|||||||
Reference in New Issue
Block a user