WPF layout (#3346)

This commit is contained in:
Pieter-Jan Briers
2021-02-21 12:38:56 +01:00
committed by GitHub
parent 33d6975c25
commit b898443f28
121 changed files with 1420 additions and 2069 deletions

View File

@@ -47,14 +47,13 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
public Button CreatePills { get; }
public Button CreateBottles { get; }
protected override Vector2? CustomSize => (400, 200);
/// <summary>
/// Create and initialize the chem master UI client-side. Creates the basic layout,
/// actual data isn't filled in until the server sends data about the chem master.
/// </summary>
public ChemMasterWindow()
{
MinSize = SetSize = (400, 200);
IoCManager.InjectDependencies(this);
Contents.AddChild(new VBoxContainer
@@ -67,16 +66,16 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
Children =
{
new Label {Text = Loc.GetString("Container")},
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
new Control {HorizontalExpand = true},
(EjectButton = new Button {Text = Loc.GetString("Eject")})
}
},
//Wrap the container info in a PanelContainer so we can color it's background differently.
new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 6,
CustomMinimumSize = (0, 200),
MinSize = (0, 200),
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(27, 27, 30)
@@ -86,7 +85,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Currently empty, when server sends state data this will have container contents and fill volume.
(ContainerInfo = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Label
@@ -99,7 +98,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
},
//Padding
new Control {CustomMinimumSize = (0.0f, 10.0f)},
new Control {MinSize = (0.0f, 10.0f)},
//Buffer
new HBoxContainer
@@ -107,7 +106,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
Children =
{
new Label {Text = Loc.GetString("Buffer")},
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
new Control {HorizontalExpand = true},
(BufferTransferButton = new Button {Text = Loc.GetString("Transfer"), Pressed = BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenRight }}),
(BufferDiscardButton = new Button {Text = Loc.GetString("Discard"), Pressed = !BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenLeft }})
}
@@ -116,9 +115,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Wrap the buffer info in a PanelContainer so we can color it's background differently.
new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 6,
CustomMinimumSize = (0, 100),
MinSize = (0, 100),
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(27, 27, 30)
@@ -128,7 +127,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Buffer reagent list
(BufferInfo = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Label
@@ -141,7 +140,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
},
//Padding
new Control {CustomMinimumSize = (0.0f, 10.0f)},
new Control {MinSize = (0.0f, 10.0f)},
//Packaging
new HBoxContainer
@@ -155,9 +154,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Wrap the packaging info in a PanelContainer so we can color it's background differently.
new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 6,
CustomMinimumSize = (0, 100),
MinSize = (0, 100),
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(27, 27, 30)
@@ -167,7 +166,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Packaging options
(PackagingInfo = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
}),
}
@@ -190,12 +189,12 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
};
PackagingInfo.AddChild(PillInfo);
var pillPadding = new Control {SizeFlagsHorizontal = SizeFlags.FillExpand};
var pillPadding = new Control {HorizontalExpand = true};
PillInfo.AddChild(pillPadding);
PillAmount = new SpinBox
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Value = 1
};
PillAmount.InitDefaultButtons();
@@ -227,12 +226,12 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
};
PackagingInfo.AddChild(BottleInfo);
var bottlePadding = new Control {SizeFlagsHorizontal = SizeFlags.FillExpand};
var bottlePadding = new Control {HorizontalExpand = true};
BottleInfo.AddChild(bottlePadding);
BottleAmount = new SpinBox
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Value = 1
};
BottleAmount.InitDefaultButtons();
@@ -351,7 +350,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
},
//Padding
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
new Control {HorizontalExpand = true},
MakeChemButton("1", ReagentUnit.New(1), reagent.ReagentId, false, StyleBase.ButtonOpenRight),
MakeChemButton("5", ReagentUnit.New(5), reagent.ReagentId, false, StyleBase.ButtonOpenBoth),
@@ -407,7 +406,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
},
//Padding
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
new Control {HorizontalExpand = true},
MakeChemButton("1", ReagentUnit.New(1), reagent.ReagentId, true, StyleBase.ButtonOpenRight),
MakeChemButton("5", ReagentUnit.New(5), reagent.ReagentId, true, StyleBase.ButtonOpenBoth),