Replace most VBox/HBoxContainers with BoxContainers (#4274)

This commit is contained in:
Visne
2021-07-18 18:39:31 +02:00
committed by GitHub
parent 0d1af2c5ff
commit bf493c39b7
101 changed files with 1143 additions and 567 deletions

View File

@@ -14,6 +14,7 @@ using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using static Content.Shared.Chemistry.Components.SharedChemMasterComponent;
using static Robust.Client.UserInterface.Controls.BaseButton;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.Chemistry.UI
{
@@ -25,11 +26,11 @@ namespace Content.Client.Chemistry.UI
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
/// <summary>Contains info about the reagent container such as it's contents, if one is loaded into the dispenser.</summary>
private readonly VBoxContainer ContainerInfo;
private readonly BoxContainer ContainerInfo;
private readonly VBoxContainer BufferInfo;
private readonly BoxContainer BufferInfo;
private readonly VBoxContainer PackagingInfo;
private readonly BoxContainer PackagingInfo;
/// <summary>Ejects the reagent container from the dispenser.</summary>
public Button EjectButton { get; }
@@ -41,8 +42,8 @@ namespace Content.Client.Chemistry.UI
public event Action<ButtonEventArgs, ChemButton>? OnChemButtonPressed;
public HBoxContainer PillInfo { get; set; }
public HBoxContainer BottleInfo { get; set; }
public BoxContainer PillInfo { get; set; }
public BoxContainer BottleInfo { get; set; }
public SpinBox PillAmount { get; set; }
public SpinBox BottleAmount { get; set; }
public Button CreatePills { get; }
@@ -57,13 +58,15 @@ namespace Content.Client.Chemistry.UI
MinSize = SetSize = (400, 525);
IoCManager.InjectDependencies(this);
Contents.AddChild(new VBoxContainer
Contents.AddChild(new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
Children =
{
//Container
new HBoxContainer
new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label {Text = Loc.GetString("chem-master-window-container-label")},
@@ -84,8 +87,9 @@ namespace Content.Client.Chemistry.UI
Children =
{
//Currently empty, when server sends state data this will have container contents and fill volume.
(ContainerInfo = new VBoxContainer
(ContainerInfo = new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
HorizontalExpand = true,
Children =
{
@@ -102,8 +106,9 @@ namespace Content.Client.Chemistry.UI
new Control {MinSize = (0.0f, 10.0f)},
//Buffer
new HBoxContainer
new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label {Text = Loc.GetString("chem-master-window-buffer-text")},
@@ -126,8 +131,9 @@ namespace Content.Client.Chemistry.UI
Children =
{
//Buffer reagent list
(BufferInfo = new VBoxContainer
(BufferInfo = new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
HorizontalExpand = true,
Children =
{
@@ -144,8 +150,9 @@ namespace Content.Client.Chemistry.UI
new Control {MinSize = (0.0f, 10.0f)},
//Packaging
new HBoxContainer
new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label {Text = $"{Loc.GetString("chem-master-window-packaging-text")} "},
@@ -165,8 +172,9 @@ namespace Content.Client.Chemistry.UI
Children =
{
//Packaging options
(PackagingInfo = new VBoxContainer
(PackagingInfo = new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
HorizontalExpand = true,
}),
@@ -176,8 +184,9 @@ namespace Content.Client.Chemistry.UI
});
//Pills
PillInfo = new HBoxContainer
PillInfo = new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label
@@ -213,8 +222,9 @@ namespace Content.Client.Chemistry.UI
PillInfo.AddChild(CreatePills);
//Bottles
BottleInfo = new HBoxContainer
BottleInfo = new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label
@@ -315,8 +325,9 @@ namespace Content.Client.Chemistry.UI
return;
}
ContainerInfo.Children.Add(new HBoxContainer // Name of the container and its fill status (Ex: 44/100u)
ContainerInfo.Children.Add(new BoxContainer // Name of the container and its fill status (Ex: 44/100u)
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label {Text = $"{state.ContainerName}: "},
@@ -339,8 +350,9 @@ namespace Content.Client.Chemistry.UI
if (proto != null)
{
ContainerInfo.Children.Add(new HBoxContainer
ContainerInfo.Children.Add(new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label {Text = $"{name}: "},
@@ -371,7 +383,10 @@ namespace Content.Client.Chemistry.UI
return;
}
var bufferHBox = new HBoxContainer();
var bufferHBox = new BoxContainer
{
Orientation = LayoutOrientation.Horizontal
};
BufferInfo.AddChild(bufferHBox);
var bufferLabel = new Label { Text = $"{Loc.GetString("chem-master-window-buffer-label")} " };
@@ -394,8 +409,9 @@ namespace Content.Client.Chemistry.UI
if (proto != null)
{
BufferInfo.Children.Add(new HBoxContainer
BufferInfo.Children.Add(new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
//SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
Children =
{