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

@@ -34,10 +34,9 @@ namespace Content.Client.GameObjects.Components.Access
private string _lastFullName;
private string _lastJobTitle;
protected override Vector2? CustomSize => (650, 270);
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager)
{
MinSize = SetSize = (650, 270);
_owner = owner;
var vBox = new VBoxContainer();
@@ -60,7 +59,7 @@ namespace Content.Client.GameObjects.Components.Access
_targetIdButton.OnPressed += _ => _owner.ButtonPressed(UiButton.TargetId);
// Separator
vBox.AddChild(new Control {CustomMinimumSize = (0, 8)});
vBox.AddChild(new Control {MinSize = (0, 8)});
// Name and job title line edits.
vBox.AddChild(new GridContainer
@@ -76,7 +75,7 @@ namespace Content.Client.GameObjects.Components.Access
}),
(_fullNameLineEdit = new LineEdit
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
}),
(_fullNameSaveButton = new Button
{
@@ -91,7 +90,7 @@ namespace Content.Client.GameObjects.Components.Access
}),
(_jobTitleLineEdit = new LineEdit
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
}),
(_jobTitleSaveButton = new Button
{
@@ -116,13 +115,13 @@ namespace Content.Client.GameObjects.Components.Access
_jobTitleSaveButton.OnPressed += _ => SubmitData();
// Separator
vBox.AddChild(new Control {CustomMinimumSize = (0, 8)});
vBox.AddChild(new Control {MinSize = (0, 8)});
{
var grid = new GridContainer
{
Columns = 5,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center
};
vBox.AddChild(grid);

View File

@@ -76,13 +76,13 @@ namespace Content.Client.GameObjects.Components.Actor
(SpriteView = new SpriteView { Scale = (2, 2)}),
new VBoxContainer
{
SizeFlagsVertical = SizeFlags.None,
VerticalAlignment = VAlignment.Top,
Children =
{
(NameLabel = new Label()),
(SubText = new Label
{
SizeFlagsVertical = SizeFlags.None,
VerticalAlignment = VAlignment.Top,
StyleClasses = {StyleNano.StyleClassLabelSubText},
})
@@ -99,7 +99,7 @@ namespace Content.Client.GameObjects.Components.Actor
AddChild(new Label
{
Text = Loc.GetString("Objectives"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center
});
ObjectivesContainer = new VBoxContainer();
AddChild(ObjectivesContainer);
@@ -135,11 +135,11 @@ namespace Content.Client.GameObjects.Components.Actor
{
Texture = objectiveCondition.SpriteSpecifier.Frame0(),
Progress = objectiveCondition.Progress,
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
});
hbox.AddChild(new Control
{
CustomMinimumSize = (10,0)
MinSize = (10,0)
});
hbox.AddChild(new VBoxContainer
{

View File

@@ -29,7 +29,7 @@ namespace Content.Client.GameObjects.Components.Atmos
var resourceCache = IoCManager.Resolve<IResourceCache>();
Owner = owner;
var rootContainer = new LayoutContainer { Name = "WireRoot" };
var rootContainer = new LayoutContainer {Name = "WireRoot"};
AddChild(rootContainer);
MouseFilter = MouseFilterMode.Stop;
@@ -66,7 +66,7 @@ namespace Content.Client.GameObjects.Components.Atmos
Children =
{
(_topContainer = new VBoxContainer()),
new Control {CustomMinimumSize = (0, 110)}
new Control {MinSize = (0, 110)}
}
};
@@ -78,42 +78,33 @@ namespace Content.Client.GameObjects.Components.Atmos
var fontSmall = resourceCache.GetFont("/Fonts/Boxfont-round/Boxfont Round.ttf", 10);
Button refreshButton;
var topRow = new MarginContainer
var topRow = new HBoxContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 2,
MarginRightOverride = 12,
MarginBottomOverride = 2,
Margin = new Thickness(4, 4, 12, 2),
Children =
{
new HBoxContainer
(_nameLabel = new Label
{
Children =
{
(_nameLabel = new Label
{
Text = Loc.GetString("Gas Analyzer"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
SizeFlagsVertical = SizeFlags.ShrinkCenter
}),
new Control
{
CustomMinimumSize = (20, 0),
SizeFlagsHorizontal = SizeFlags.Expand
},
(refreshButton = new Button {Text = "Refresh"}), //TODO: refresh icon?
new Control
{
CustomMinimumSize = (2, 0),
},
(CloseButton = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
SizeFlagsVertical = SizeFlags.ShrinkCenter
})
}
}
Text = Loc.GetString("Gas Analyzer"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
VerticalAlignment = VAlignment.Center
}),
new Control
{
MinSize = (20, 0),
HorizontalExpand = true,
},
(refreshButton = new Button {Text = "Refresh"}), //TODO: refresh icon?
new Control
{
MinSize = (2, 0),
},
(CloseButton = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
VerticalAlignment = VAlignment.Center
})
}
};
@@ -124,37 +115,30 @@ namespace Content.Client.GameObjects.Components.Atmos
var middle = new PanelContainer
{
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#202025") },
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#202025")},
Children =
{
new MarginContainer
(_statusContainer = new VBoxContainer
{
MarginLeftOverride = 8,
MarginRightOverride = 8,
MarginTopOverride = 4,
MarginBottomOverride = 4,
Children =
{
(_statusContainer = new VBoxContainer())
}
}
Margin = new Thickness(8, 8, 4, 4)
})
}
};
_topContainer.AddChild(topRow);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#525252ff") }
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
_topContainer.AddChild(middle);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#525252ff") }
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
CloseButton.OnPressed += _ => Close();
LayoutContainer.SetSize(this, (300, 200));
SetSize = (300, 200);
}
@@ -177,17 +161,19 @@ namespace Content.Client.GameObjects.Components.Atmos
});
_statusContainer.AddChild(new Label
{
Text = Loc.GetString("Temperature: {0:0.#}K ({1:0.#}°C)", state.Temperature, TemperatureHelpers.KelvinToCelsius(state.Temperature))
Text = Loc.GetString("Temperature: {0:0.#}K ({1:0.#}°C)", state.Temperature,
TemperatureHelpers.KelvinToCelsius(state.Temperature))
});
// Return here cause all that stuff down there is gas stuff (so we don't get the seperators)
if (state.Gases.Length == 0)
{
return;
}
// Seperator
_statusContainer.AddChild(new Control
{
CustomMinimumSize = new Vector2(0, 10)
MinSize = new Vector2(0, 10)
});
// Add a table with all the gases
@@ -200,7 +186,7 @@ namespace Content.Client.GameObjects.Components.Atmos
tableKey,
new Control
{
CustomMinimumSize = new Vector2(20, 0)
MinSize = new Vector2(20, 0)
},
tableVal
}
@@ -210,13 +196,13 @@ namespace Content.Client.GameObjects.Components.Atmos
var minSize = 24; // This basically allows gases which are too small, to be shown properly
var gasBar = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
CustomMinimumSize = new Vector2(0, height)
HorizontalExpand = true,
MinSize = new Vector2(0, height)
};
// Seperator
_statusContainer.AddChild(new Control
{
CustomMinimumSize = new Vector2(0, 10)
MinSize = new Vector2(0, 10)
});
var totalGasAmount = 0f;
@@ -244,8 +230,9 @@ namespace Content.Client.GameObjects.Components.Atmos
var right = (i == state.Gases.Length - 1) ? 0f : 2f;
gasBar.AddChild(new PanelContainer
{
ToolTip = Loc.GetString("{0}: {1:0.##} mol ({2:0.#}%)", gas.Name, gas.Amount, (gas.Amount / totalGasAmount) * 100),
SizeFlagsHorizontal = SizeFlags.FillExpand,
ToolTip = Loc.GetString("{0}: {1:0.##} mol ({2:0.#}%)", gas.Name, gas.Amount,
(gas.Amount / totalGasAmount) * 100),
HorizontalExpand = true,
SizeFlagsStretchRatio = gas.Amount,
MouseFilter = MouseFilterMode.Pass,
PanelOverride = new StyleBoxFlat
@@ -254,9 +241,10 @@ namespace Content.Client.GameObjects.Components.Atmos
PaddingLeft = left,
PaddingRight = right
},
CustomMinimumSize = new Vector2(minSize, 0)
MinSize = new Vector2(minSize, 0)
});
}
_statusContainer.AddChild(gasBar);
}

View File

@@ -31,10 +31,9 @@ namespace Content.Client.GameObjects.Components.Atmos
public List<ReleasePressureButton> ReleasePressureButtons { get; private set; }
protected override Vector2? CustomSize => (300, 200);
public GasCanisterWindow()
{
SetSize = MinSize = (300, 200);
HBoxContainer releasePressureButtons;
Contents.AddChild(new VBoxContainer
@@ -51,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Atmos
{
new Label(){ Text = Loc.GetString("Label: ") },
(LabelInput = new LineEdit() { Text = Name, Editable = false,
CustomMinimumSize = new Vector2(200, 30)}),
MinSize = new Vector2(200, 30)}),
(EditLabelBtn = new Button()),
}
},

View File

@@ -34,7 +34,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
// Left half
new ScrollContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(BodyPartList = new ItemList())
@@ -43,13 +43,13 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
// Right half
new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
// Top half of the right half
new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
(BodyPartLabel = new Label()),
@@ -66,7 +66,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
},
new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
(MechanismList = new ItemList())
@@ -77,7 +77,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
// Bottom half of the right half
(MechanismInfoLabel = new RichTextLabel
{
SizeFlagsVertical = SizeFlags.FillExpand
VerticalExpand = true
})
}
}
@@ -88,12 +88,11 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
BodyPartList.OnItemSelected += BodyPartOnItemSelected;
MechanismList.OnItemSelected += MechanismOnItemSelected;
MinSize = SetSize = (800, 600);
}
public BodyScannerBoundUserInterface Owner { get; }
protected override Vector2? CustomSize => (800, 600);
private ItemList BodyPartList { get; }
private Label BodyPartLabel { get; }

View File

@@ -15,10 +15,9 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
private readonly VBoxContainer _optionsBox;
private OptionSelectedCallback _optionSelectedCallback;
protected override Vector2? CustomSize => (300, 400);
public SurgeryWindow()
{
MinSize = SetSize = (300, 400);
Title = Loc.GetString("Surgery");
RectClipContent = true;
@@ -28,15 +27,15 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
{
new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
HScrollEnabled = true,
VScrollEnabled = true,
Children =
{
(_optionsBox = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
})
}
}
@@ -87,8 +86,8 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
Button = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
ToggleMode = true,
MouseFilter = MouseFilterMode.Stop
};
@@ -101,16 +100,16 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
{
(SpriteView = new SpriteView
{
CustomMinimumSize = new Vector2(32.0f, 32.0f)
MinSize = new Vector2(32.0f, 32.0f)
}),
(DisplayText = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Text = "N/A",
}),
(new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
})
}
});

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),

View File

@@ -61,14 +61,13 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
/// <summary>A grid of buttons for each reagent which can be dispensed.</summary>
public GridContainer ChemicalList { get; }
protected override Vector2? CustomSize => (500, 600);
/// <summary>
/// Create and initialize the dispenser UI client-side. Creates the basic layout,
/// actual data isn't filled in until the server sends data about the dispenser.
/// </summary>
public ReagentDispenserWindow()
{
SetSize = MinSize = (500, 600);
IoCManager.InjectDependencies(this);
var dispenseAmountGroup = new ButtonGroup();
@@ -84,7 +83,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
{
new Label {Text = Loc.GetString("Amount")},
//Padding
new Control {CustomMinimumSize = (20, 0)},
new Control {MinSize = (20, 0)},
(DispenseButton1 = new Button {Text = "1", Group = dispenseAmountGroup, StyleClasses = { StyleBase.ButtonOpenRight }}),
(DispenseButton5 = new Button {Text = "5", Group = dispenseAmountGroup, StyleClasses = { StyleBase.ButtonOpenBoth }}),
(DispenseButton10 = new Button {Text = "10", Group = dispenseAmountGroup, StyleClasses = { StyleBase.ButtonOpenBoth }}),
@@ -97,14 +96,14 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
}
},
//Padding
new Control {CustomMinimumSize = (0.0f, 10.0f)},
new Control {MinSize = (0.0f, 10.0f)},
//Grid of which reagents can be dispensed.
(ChemicalList = new GridContainer
{
Columns = 5
}),
//Padding
new Control {CustomMinimumSize = (0.0f, 10.0f)},
new Control {MinSize = (0.0f, 10.0f)},
new HBoxContainer
{
Children =
@@ -117,9 +116,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
//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, 150),
MinSize = (0, 150),
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(27, 27, 30)
@@ -129,7 +128,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
//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

View File

@@ -1,5 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Robust.Client.UserInterface;
@@ -7,8 +6,6 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using static Content.Shared.GameObjects.Components.Medical.SharedCloningPodComponent;
namespace Content.Client.GameObjects.Components.CloningPod
@@ -17,68 +14,36 @@ namespace Content.Client.GameObjects.Components.CloningPod
{
private Dictionary<int, string> _scanManager;
private readonly VBoxContainer _mainVBox;
private readonly ScanListContainer _scanList;
private readonly LineEdit _searchBar;
private readonly Button _clearButton;
private readonly VBoxContainer _scanList;
public readonly Button CloneButton;
public readonly Button EjectButton;
private readonly CloningScanButton _measureButton;
private CloningScanButton? _selectedButton;
private readonly Label _progressLabel;
private readonly ProgressBar _cloningProgressBar;
private readonly Label _mindState;
protected override Vector2 ContentsMinimumSize => _mainVBox?.CombinedMinimumSize ?? Vector2.Zero;
private CloningPodBoundUserInterfaceState _lastUpdate = null!;
// List of scans that are visible based on current filter criteria.
private readonly Dictionary<int, string> _filteredScans = new();
// The indices of the visible scans last time UpdateVisibleScans was ran.
// This is inclusive, so end is the index of the last scan, not right after it.
private (int start, int end) _lastScanIndices;
public int? SelectedScan;
protected override Vector2? CustomSize => (250, 300);
public CloningPodWindow(
Dictionary<int, string> scanManager)
public CloningPodWindow(Dictionary<int, string> scanManager)
{
SetSize = MinSize = (250, 300);
_scanManager = scanManager;
Title = Loc.GetString("Cloning Machine");
Contents.AddChild(_mainVBox = new VBoxContainer
Contents.AddChild(new VBoxContainer
{
Children =
{
new HBoxContainer
{
Children =
{
(_searchBar = new LineEdit
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
PlaceHolder = Loc.GetString("Search")
}),
(_clearButton = new Button
{
Disabled = true,
Text = Loc.GetString("Clear"),
})
}
},
new ScrollContainer
{
CustomMinimumSize = new Vector2(200.0f, 0.0f),
SizeFlagsVertical = SizeFlags.FillExpand,
MinSize = new Vector2(200.0f, 0.0f),
VerticalExpand = true,
Children =
{
(_scanList = new ScanListContainer())
(_scanList = new VBoxContainer())
}
},
new VBoxContainer
@@ -91,11 +56,9 @@ namespace Content.Client.GameObjects.Components.CloningPod
})
}
},
(_measureButton = new CloningScanButton {Visible = false}),
(_cloningProgressBar = new ProgressBar
{
CustomMinimumSize = (200, 20),
SizeFlagsHorizontal = SizeFlags.Fill,
MinSize = (200, 20),
MinValue = 0,
MaxValue = 10,
Page = 0,
@@ -127,13 +90,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
}
});
_searchBar.OnTextChanged += OnSearchBarTextChanged;
_clearButton.OnPressed += OnClearButtonPressed;
BuildEntityList();
_searchBar.GrabKeyboardFocus();
BuildCloneList();
}
public void Populate(CloningPodBoundUserInterfaceState state)
@@ -143,7 +100,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
if (_lastUpdate == null || _lastUpdate.MindIdName.Count != state.MindIdName.Count)
{
_scanManager = state.MindIdName;
BuildEntityList();
BuildCloneList();
_lastUpdate = state;
}
@@ -155,130 +112,31 @@ namespace Content.Client.GameObjects.Components.CloningPod
_mindState.FontColorOverride = state.MindPresent ? Color.Green : Color.Red;
}
private void OnSearchBarTextChanged(LineEdit.LineEditEventArgs args)
private void BuildCloneList()
{
BuildEntityList(args.Text);
_clearButton.Disabled = string.IsNullOrEmpty(args.Text);
}
private void OnClearButtonPressed(BaseButton.ButtonEventArgs args)
{
_searchBar.Clear();
BuildEntityList("");
}
private void BuildEntityList(string? searchStr = null)
{
_filteredScans.Clear();
_scanList.RemoveAllChildren();
// Reset last scan indices so it automatically updates the entire list.
_lastScanIndices = (0, -1);
_scanList.RemoveAllChildren();
_selectedButton = null;
searchStr = searchStr?.ToLowerInvariant();
foreach (var scan in _scanManager)
{
if (searchStr != null && !_doesScanMatchSearch(scan.Value, searchStr))
var button = new CloningScanButton
{
continue;
Scan = scan.Value,
Id = scan.Key
};
button.ActualButton.OnToggled += OnItemButtonToggled;
var entityLabelText = scan.Value;
button.EntityLabel.Text = entityLabelText;
if (scan.Key == SelectedScan)
{
_selectedButton = button;
_selectedButton.ActualButton.Pressed = true;
}
_filteredScans.Add(scan.Key, scan.Value);
}
//TODO: set up sort
//_filteredScans.Sort((a, b) => string.Compare(a.ToString(), b.ToString(), StringComparison.Ordinal));
_scanList.TotalItemCount = _filteredScans.Count;
}
private void UpdateVisibleScans()
{
// Update visible buttons in the scan list.
// Calculate index of first scan to render based on current scroll.
var height = _measureButton.CombinedMinimumSize.Y + ScanListContainer.Separation;
var offset = -_scanList.Position.Y;
var startIndex = (int) Math.Floor(offset / height);
_scanList.ItemOffset = startIndex;
var (prevStart, prevEnd) = _lastScanIndices;
// Calculate index of final one.
var endIndex = startIndex - 1;
var spaceUsed = -height; // -height instead of 0 because else it cuts off the last button.
while (spaceUsed < _scanList.Parent!.Height)
{
spaceUsed += height;
endIndex += 1;
}
endIndex = Math.Min(endIndex, _filteredScans.Count - 1);
if (endIndex == prevEnd && startIndex == prevStart)
{
// Nothing changed so bye.
return;
}
_lastScanIndices = (startIndex, endIndex);
// Delete buttons at the start of the list that are no longer visible (scrolling down).
for (var i = prevStart; i < startIndex && i <= prevEnd; i++)
{
var control = (CloningScanButton) _scanList.GetChild(0);
DebugTools.Assert(control.Index == i);
_scanList.RemoveChild(control);
}
// Delete buttons at the end of the list that are no longer visible (scrolling up).
for (var i = prevEnd; i > endIndex && i >= prevStart; i--)
{
var control = (CloningScanButton) _scanList.GetChild(_scanList.ChildCount - 1);
DebugTools.Assert(control.Index == i);
_scanList.RemoveChild(control);
}
var array = _filteredScans.ToArray();
// Create buttons at the start of the list that are now visible (scrolling up).
for (var i = Math.Min(prevStart - 1, endIndex); i >= startIndex; i--)
{
InsertEntityButton(array[i], true, i);
}
// Create buttons at the end of the list that are now visible (scrolling down).
for (var i = Math.Max(prevEnd + 1, startIndex); i <= endIndex; i++)
{
InsertEntityButton(array[i], false, i);
}
}
// Create a spawn button and insert it into the start or end of the list.
private void InsertEntityButton(KeyValuePair<int, string> scan, bool insertFirst, int index)
{
var button = new CloningScanButton
{
Scan = scan.Value,
Id = scan.Key,
Index = index // We track this index purely for debugging.
};
button.ActualButton.OnToggled += OnItemButtonToggled;
var entityLabelText = scan.Value;
button.EntityLabel.Text = entityLabelText;
if (scan.Key == SelectedScan)
{
_selectedButton = button;
_selectedButton.ActualButton.Pressed = true;
}
//TODO: replace with body's face
/*var tex = IconComponent.GetScanIcon(scan, resourceCache);
//TODO: replace with body's face
/*var tex = IconComponent.GetScanIcon(scan, resourceCache);
var rect = button.EntityTextureRect;
if (tex != null)
{
@@ -292,16 +150,11 @@ namespace Content.Client.GameObjects.Components.CloningPod
rect.Dispose();
*/
_scanList.AddChild(button);
if (insertFirst)
{
button.SetPositionInParent(0);
_scanList.AddChild(button);
}
}
private static bool _doesScanMatchSearch(string scan, string searchStr)
{
return scan.ToLowerInvariant().Contains(searchStr);
//TODO: set up sort
//_filteredScans.Sort((a, b) => string.Compare(a.ToString(), b.ToString(), StringComparison.Ordinal));
}
private void OnItemButtonToggled(BaseButton.ButtonToggledEventArgs args)
@@ -325,76 +178,6 @@ namespace Content.Client.GameObjects.Components.CloningPod
SelectedScan = item.Id;
}
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
UpdateVisibleScans();
}
private class ScanListContainer : Container
{
// Quick and dirty container to do virtualization of the list.
// Basically, get total item count and offset to put the current buttons at.
// Get a constant minimum height and move the buttons in the list up to match the scrollbar.
private int _totalItemCount;
private int _itemOffset;
public int TotalItemCount
{
get => _totalItemCount;
set
{
_totalItemCount = value;
MinimumSizeChanged();
}
}
public int ItemOffset
{
get => _itemOffset;
set
{
_itemOffset = value;
UpdateLayout();
}
}
public const float Separation = 2;
protected override Vector2 CalculateMinimumSize()
{
if (ChildCount == 0)
{
return Vector2.Zero;
}
var first = GetChild(0);
var (minX, minY) = first.CombinedMinimumSize;
return (minX, minY * TotalItemCount + (TotalItemCount - 1) * Separation);
}
protected override void LayoutUpdateOverride()
{
if (ChildCount == 0)
{
return;
}
var first = GetChild(0);
var height = first.CombinedMinimumSize.Y;
var offset = ItemOffset * height + (ItemOffset - 1) * Separation;
foreach (var child in Children)
{
FitChildInBox(child, UIBox2.FromDimensions(0, offset, Width, height));
offset += Separation + height;
}
}
}
[DebuggerDisplay("cloningbutton {" + nameof(Index) + "}")]
private class CloningScanButton : Control
{
@@ -409,8 +192,8 @@ namespace Content.Client.GameObjects.Components.CloningPod
{
AddChild(ActualButton = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
ToggleMode = true,
});
@@ -420,16 +203,16 @@ namespace Content.Client.GameObjects.Components.CloningPod
{
(EntityTextureRect = new TextureRect
{
CustomMinimumSize = (32, 32),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
MinSize = (32, 32),
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
Stretch = TextureRect.StretchMode.KeepAspectCentered,
CanShrink = true
}),
(EntityLabel = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
Text = "",
ClipText = true
})

View File

@@ -19,80 +19,52 @@ namespace Content.Client.GameObjects.Components.Wires
private readonly List<(string name, LineEdit input)> _inputs;
protected override Vector2? CustomSize => (300, 250);
public ConfigurationMenu(ConfigurationBoundUserInterface owner)
{
MinSize = SetSize = (300, 250);
Owner = owner;
_inputs = new List<(string name, LineEdit input)>();
Title = Loc.GetString("Device Configuration");
var margin = new MarginContainer
{
MarginBottomOverride = 8,
MarginLeftOverride = 8,
MarginRightOverride = 8,
MarginTopOverride = 8
};
_baseContainer = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand
VerticalExpand = true,
HorizontalExpand = true
};
_column = new VBoxContainer
{
Margin = new Thickness(8),
SeparationOverride = 16,
SizeFlagsVertical = SizeFlags.Fill
};
_row = new HBoxContainer
{
SeparationOverride = 16,
SizeFlagsHorizontal = SizeFlags.FillExpand
};
var buttonRow = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
};
var spacer1 = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.Expand
};
var spacer2 = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.Expand
HorizontalExpand = true
};
var confirmButton = new Button
{
Text = Loc.GetString("Confirm"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
confirmButton.OnButtonUp += OnConfirm;
buttonRow.AddChild(spacer1);
buttonRow.AddChild(confirmButton);
buttonRow.AddChild(spacer2);
var outerColumn = new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
ModulateSelfOverride = Color.FromHex("#202025")
};
margin.AddChild(_column);
outerColumn.AddChild(margin);
outerColumn.AddChild(_column);
_baseContainer.AddChild(outerColumn);
_baseContainer.AddChild(buttonRow);
_baseContainer.AddChild(confirmButton);
Contents.AddChild(_baseContainer);
}
@@ -103,19 +75,15 @@ namespace Content.Client.GameObjects.Components.Wires
foreach (var field in state.Config)
{
var margin = new MarginContainer
{
MarginRightOverride = 8
};
var label = new Label
{
Margin = new Thickness(0, 0, 8, 0),
Name = field.Key,
Text = field.Key + ":",
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
SizeFlagsStretchRatio = .2f,
CustomMinimumSize = new Vector2(60, 0)
MinSize = new Vector2(60, 0)
};
var input = new LineEdit
@@ -123,7 +91,7 @@ namespace Content.Client.GameObjects.Components.Wires
Name = field.Key + "-input",
Text = field.Value,
IsValid = Validate,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = .8f
};
@@ -132,8 +100,7 @@ namespace Content.Client.GameObjects.Components.Wires
var row = new HBoxContainer();
CopyProperties(_row, row);
margin.AddChild(label);
row.AddChild(margin);
row.AddChild(label);
row.AddChild(input);
_column.AddChild(row);
}

View File

@@ -20,10 +20,9 @@ namespace Content.Client.GameObjects.Components.Crayon
private string _selected;
private Color _color;
protected override Vector2? CustomSize => (250, 300);
public CrayonWindow(CrayonBoundUserInterface owner)
{
MinSize = SetSize = (250, 300);
Title = Loc.GetString("Crayon");
Owner = owner;
@@ -40,7 +39,7 @@ namespace Content.Client.GameObjects.Components.Crayon
};
var gridScroll = new ScrollContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
_grid
@@ -115,7 +114,7 @@ namespace Content.Client.GameObjects.Components.Crayon
var rsi = new SpriteSpecifier.Rsi(path, state);
_decals.Add(state, rsi.Frame0());
}
RefreshList();
}
}

View File

@@ -26,189 +26,167 @@ namespace Content.Client.GameObjects.Components.Disposal
public List<string> TargetList;
private readonly Label _tagLabel;
protected override Vector2? CustomSize => (460, 220);
public DisposalMailingUnitWindow()
{
MinSize = SetSize = (460, 220);
TargetList = new List<string>();
Contents.AddChild(new HBoxContainer
{
Children =
{
new MarginContainer
new VBoxContainer
{
MarginLeftOverride = 8,
MarginRightOverride = 8,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Margin = new Thickness(8, 0),
Children =
{
new VBoxContainer
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new HBoxContainer
new Label {Text = Loc.GetString("State: ")},
new Control {MinSize = (4, 0)},
(_unitState = new Label {Text = Loc.GetString("Ready")})
}
},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
HorizontalExpand = true,
Children =
{
new Label {Text = Loc.GetString("Pressure:")},
new Control {MinSize = (4, 0)},
(_pressureBar = new ProgressBar
{
MinSize = (100, 20),
HorizontalExpand = true,
MinValue = 0,
MaxValue = 1,
Page = 0,
Value = 0.5f,
Children =
{
new Label {Text = Loc.GetString("State: ")},
new Control {CustomMinimumSize = (4, 0)},
(_unitState = new Label {Text = Loc.GetString("Ready")})
(_pressurePercentage = new Label())
}
})
}
},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
HorizontalExpand = true,
Children =
{
new Label {Text = Loc.GetString("Handle:")},
new Control
{
MinSize = (4, 0),
HorizontalExpand = true
},
new Control {CustomMinimumSize = (0, 10)},
new HBoxContainer
(Engage = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label {Text = Loc.GetString("Pressure:")},
new Control {CustomMinimumSize = (4, 0)},
(_pressureBar = new ProgressBar
{
CustomMinimumSize = (100, 20),
SizeFlagsHorizontal = SizeFlags.FillExpand,
MinValue = 0,
MaxValue = 1,
Page = 0,
Value = 0.5f,
Children =
{
(_pressurePercentage = new Label())
}
})
}
MinSize = (16, 0),
Text = Loc.GetString("Engage"),
ToggleMode = true,
Disabled = true
})
}
},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
HorizontalExpand = true,
Children =
{
new Label {Text = Loc.GetString("Eject:")},
new Control
{
MinSize = (4, 0),
HorizontalExpand = true
},
new Control {CustomMinimumSize = (0, 10)},
new HBoxContainer
(Eject = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label {Text = Loc.GetString("Handle:")},
new Control {
CustomMinimumSize = (4, 0),
SizeFlagsHorizontal = SizeFlags.FillExpand
},
(Engage = new Button
{
CustomMinimumSize = (16, 0),
Text = Loc.GetString("Engage"),
ToggleMode = true,
Disabled = true
})
}
},
new Control {CustomMinimumSize = (0, 10)},
new HBoxContainer
MinSize = (16, 0),
Text = Loc.GetString("Eject Contents"),
//HorizontalAlignment = HAlignment.Right
})
}
},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
{
(Power = new CheckButton {Text = Loc.GetString("Power")}),
}
}
}
},
new VBoxContainer
{
Margin = new Thickness(12, 0, 8, 0),
Children =
{
new HBoxContainer
{
Children =
{
new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label {Text = Loc.GetString("Eject:")},
new Control {
CustomMinimumSize = (4, 0),
SizeFlagsHorizontal = SizeFlags.FillExpand
},
(Eject = new Button {
CustomMinimumSize = (16, 0),
Text = Loc.GetString("Eject Contents"),
//SizeFlagsHorizontal = SizeFlags.ShrinkEnd
})
}
},
new Control {CustomMinimumSize = (0, 10)},
new HBoxContainer
{
Children =
{
(Power = new CheckButton {Text = Loc.GetString("Power")}),
}
Text = Loc.GetString("Select a destination:")
}
}
},
}
},
new MarginContainer
{
MarginLeftOverride = 12,
MarginRightOverride = 8,
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new VBoxContainer
new Control {MinSize = new Vector2(0, 8)},
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.Fill,
VerticalExpand = true,
Children =
{
new HBoxContainer
(TargetListContainer = new ItemList
{
SelectMode = ItemList.ItemListSelectMode.Single,
HorizontalExpand = true,
VerticalExpand = true
})
}
},
new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = Color.FromHex("#ACBDBA")
},
HorizontalExpand = true,
MinSize = new Vector2(0, 1),
},
new HBoxContainer
{
Children =
{
new VBoxContainer
{
Children =
{
new Label
{
Text = Loc.GetString("Select a destination:")
}
}
},
new Control { CustomMinimumSize = new Vector2(0, 8) },
new HBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
Children =
{
(TargetListContainer = new ItemList
{
SelectMode = ItemList.ItemListSelectMode.Single,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand
})
}
},
new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = Color.FromHex("#ACBDBA")
},
SizeFlagsHorizontal = SizeFlags.FillExpand,
CustomMinimumSize = new Vector2(0, 1),
},
new HBoxContainer
{
Children =
{
new VBoxContainer
new HBoxContainer
{
Margin = new Thickness(4, 0, 0, 0),
Children =
{
new MarginContainer
new Label
{
MarginLeftOverride = 4,
Children =
{
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label
{
Text = Loc.GetString("This unit:")
},
new Control
{
CustomMinimumSize = new Vector2(4, 0)
},
(_tagLabel = new Label
{
Text = "-",
SizeFlagsVertical = SizeFlags.ShrinkEnd
})
}
}
}
Text = Loc.GetString("This unit:")
},
new Control
{
MinSize = new Vector2(4, 0)
},
(_tagLabel = new Label
{
Text = "-",
VerticalAlignment = VAlignment.Bottom
})
}
}
}

View File

@@ -16,10 +16,9 @@ namespace Content.Client.GameObjects.Components.Disposal
public readonly LineEdit TagInput;
public readonly Button Confirm;
protected override Vector2? CustomSize => (400, 80);
public DisposalRouterWindow()
{
MinSize = SetSize = (400, 80);
Title = Loc.GetString("Disposal Router");
Contents.AddChild(new VBoxContainer
@@ -27,14 +26,19 @@ namespace Content.Client.GameObjects.Components.Disposal
Children =
{
new Label {Text = Loc.GetString("Tags:")},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
{
(TagInput = new LineEdit {SizeFlagsHorizontal = SizeFlags.Expand, CustomMinimumSize = (320, 0),
ToolTip = Loc.GetString("A comma separated list of tags"), IsValid = tags => TagRegex.IsMatch(tags)}),
new Control {CustomMinimumSize = (10, 0)},
(TagInput = new LineEdit
{
HorizontalExpand = true,
MinSize = (320, 0),
ToolTip = Loc.GetString("A comma separated list of tags"),
IsValid = tags => TagRegex.IsMatch(tags)
}),
new Control {MinSize = (10, 0)},
(Confirm = new Button {Text = Loc.GetString("Confirm")})
}
}

View File

@@ -16,10 +16,9 @@ namespace Content.Client.GameObjects.Components.Disposal
public readonly LineEdit TagInput;
public readonly Button Confirm;
protected override Vector2? CustomSize => (400, 80);
public DisposalTaggerWindow()
{
MinSize = SetSize = (400, 80);
Title = Loc.GetString("Disposal Tagger");
Contents.AddChild(new VBoxContainer
@@ -27,14 +26,18 @@ namespace Content.Client.GameObjects.Components.Disposal
Children =
{
new Label {Text = Loc.GetString("Tag:")},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
{
(TagInput = new LineEdit {SizeFlagsHorizontal = SizeFlags.Expand, CustomMinimumSize = (320, 0),
IsValid = tag => TagRegex.IsMatch(tag)}),
new Control {CustomMinimumSize = (10, 0)},
(TagInput = new LineEdit
{
HorizontalExpand = true,
MinSize = (320, 0),
IsValid = tag => TagRegex.IsMatch(tag)
}),
new Control {MinSize = (10, 0)},
(Confirm = new Button {Text = Loc.GetString("Confirm")})
}
}

View File

@@ -21,10 +21,10 @@ namespace Content.Client.GameObjects.Components.Disposal
public readonly Button Eject;
public readonly Button Power;
protected override Vector2? CustomSize => (300, 200);
public DisposalUnitWindow()
{
MinSize = SetSize = (300, 200);
Contents.AddChild(new VBoxContainer
{
Children =
@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components.Disposal
(_unitState = new Label {Text = Loc.GetString("Ready")})
}
},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
@@ -45,8 +45,8 @@ namespace Content.Client.GameObjects.Components.Disposal
new Label {Text = Loc.GetString("Pressure:")},
(_pressureBar = new ProgressBar
{
CustomMinimumSize = (200, 20),
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
MinSize = (200, 20),
HorizontalAlignment = HAlignment.Right,
MinValue = 0,
MaxValue = 1,
Page = 0,
@@ -58,7 +58,7 @@ namespace Content.Client.GameObjects.Components.Disposal
})
}
},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
@@ -71,7 +71,7 @@ namespace Content.Client.GameObjects.Components.Disposal
})
}
},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
@@ -80,7 +80,7 @@ namespace Content.Client.GameObjects.Components.Disposal
(Eject = new Button {Text = Loc.GetString("Eject Contents")})
}
},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =

View File

@@ -73,7 +73,7 @@ namespace Content.Client.GameObjects.Components.Gravity
var vBox = new VBoxContainer
{
CustomMinimumSize = new Vector2(250, 100)
MinSize = new Vector2(250, 100)
};
Status = new Label
{
@@ -84,7 +84,7 @@ namespace Content.Client.GameObjects.Components.Gravity
{
Text = Loc.GetString(Owner.IsOn ? "Turn Off" : "Turn On"),
TextAlign = Label.AlignMode.Center,
CustomMinimumSize = new Vector2(150, 60)
MinSize = new Vector2(150, 60)
};
vBox.AddChild(Status);

View File

@@ -87,7 +87,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
_hudButtonPocket1,
_hudButtonPocket2,
// keeps this "balanced" with the left, so the hands will appear perfectly in the center
new Control{CustomMinimumSize = (64, 64)}
new Control{MinSize = (64, 64)}
},
SeparationOverride = 5
};
@@ -226,7 +226,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
const int width = ButtonSize * 4 + ButtonSeparation * 3 + RightSeparation;
const int height = ButtonSize * 4 + ButtonSeparation * 3;
var windowContents = new LayoutContainer {CustomMinimumSize = (width, height)};
var windowContents = new LayoutContainer {MinSize = (width, height)};
Contents.AddChild(windowContents);
void AddButton(Slots slot, string textureName, Vector2 position)

View File

@@ -57,14 +57,14 @@ namespace Content.Client.GameObjects.Components
var wrapper = new HBoxContainer
{
SeparationOverride = 4,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center
};
AddChild(wrapper);
for (var i = 0; i < _sections.Length; i++)
{
var panel = new PanelContainer {CustomMinimumSize = (20, 20)};
var panel = new PanelContainer {MinSize = (20, 20)};
wrapper.AddChild(panel);
_sections[i] = panel;
}

View File

@@ -139,8 +139,6 @@ namespace Content.Client.GameObjects.Components.Kitchen
}
protected override Vector2? CustomSize => (512, 256);
private MicrowaveBoundUserInterface Owner { get; set; }
public event Action<BaseButton.ButtonEventArgs, int> OnCookTimeSelected;
@@ -165,54 +163,49 @@ namespace Content.Client.GameObjects.Components.Kitchen
public MicrowaveMenu(MicrowaveBoundUserInterface owner = null)
{
SetSize = MinSize = (512, 256);
Owner = owner;
Title = Loc.GetString("Microwave");
DisableCookingPanelOverlay = new PanelContainer
{
MouseFilter = MouseFilterMode.Stop,
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.60f)},
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
};
var hSplit = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill
};
var hSplit = new HBoxContainer();
IngredientsListReagents = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 128)
MinSize = (100, 128)
};
IngredientsList = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 128)
MinSize = (100, 128)
};
hSplit.AddChild(IngredientsListReagents);
//Padding between the lists.
hSplit.AddChild(new Control
{
CustomMinimumSize = (0, 5),
MinSize = (0, 5),
});
hSplit.AddChild(IngredientsList);
var vSplit = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
};
hSplit.AddChild(vSplit);
@@ -243,14 +236,13 @@ namespace Content.Client.GameObjects.Components.Kitchen
//Padding
vSplit.AddChild(new Control
{
CustomMinimumSize = (0, 15),
SizeFlagsVertical = SizeFlags.Fill,
MinSize = (0, 15),
});
CookTimeButtonGroup = new ButtonGroup();
CookTimeButtonVbox = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Align = BoxContainer.AlignMode.Center,
};
@@ -284,14 +276,14 @@ namespace Content.Client.GameObjects.Components.Kitchen
Text = Loc.GetString("COOK TIME: 1"),
Align = Label.AlignMode.Center,
Modulate = Color.White,
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
};
var innerTimerPanel = new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
ModulateSelfOverride = Color.Red,
CustomMinimumSize = (100, 128),
MinSize = (100, 128),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.5f)},
Children =
@@ -312,7 +304,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
new ScrollContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
@@ -326,8 +318,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
TimerFacePlate = new PanelContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
Children =
{
innerTimerPanel

View File

@@ -156,7 +156,6 @@ namespace Content.Client.GameObjects.Components.Kitchen
*/
private ReagentGrinderBoundUserInterface Owner { get; set; }
protected override Vector2? CustomSize => (512, 256);
//We'll need 4 buttons, grind, juice, eject beaker, eject the chamber contents.
//The other 2 are referenced in the Open function.
@@ -202,11 +201,11 @@ namespace Content.Client.GameObjects.Components.Kitchen
AddChild(vSplit);
BoxContents = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 128)
MinSize = (100, 128)
};
AddChild(BoxContents);
}
@@ -214,47 +213,44 @@ namespace Content.Client.GameObjects.Components.Kitchen
public GrinderMenu(ReagentGrinderBoundUserInterface owner = null)
{
SetSize = MinSize = (512, 256);
Owner = owner;
Title = Loc.GetString("All-In-One Grinder 3000");
var hSplit = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill
};
var hSplit = new HBoxContainer();
var vBoxGrindJuiceButtonPanel = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
};
GrindButton = new Button
{
Text = Loc.GetString("Grind"),
TextAlign = Label.AlignMode.Center,
CustomMinimumSize = (64, 64)
MinSize = (64, 64)
};
JuiceButton = new Button
{
Text = Loc.GetString("Juice"),
TextAlign = Label.AlignMode.Center,
CustomMinimumSize = (64, 64)
MinSize = (64, 64)
};
vBoxGrindJuiceButtonPanel.AddChild(GrindButton);
//inner button padding
vBoxGrindJuiceButtonPanel.AddChild(new Control
{
CustomMinimumSize = (0, 16),
MinSize = (0, 16),
});
vBoxGrindJuiceButtonPanel.AddChild(JuiceButton);
ChamberContentBox = new LabelledContentBox(Loc.GetString("Chamber"), Loc.GetString("Eject Contents"))
{
//Modulate = Color.Red,
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SizeFlagsStretchRatio = 2,
};
@@ -262,8 +258,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
BeakerContentBox = new LabelledContentBox(Loc.GetString("Beaker"), Loc.GetString("Eject Beaker"))
{
//Modulate = Color.Blue,
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SizeFlagsStretchRatio = 2,
};
@@ -272,14 +268,14 @@ namespace Content.Client.GameObjects.Components.Kitchen
//Padding between the g/j buttons panel and the itemlist boxes panel.
hSplit.AddChild(new Control
{
CustomMinimumSize = (16, 0),
MinSize = (16, 0),
});
hSplit.AddChild(ChamberContentBox);
//Padding between the two itemlists.
hSplit.AddChild(new Control
{
CustomMinimumSize = (8, 0),
MinSize = (8, 0),
});
hSplit.AddChild(BeakerContentBox);
Contents.AddChild(hSplit);

View File

@@ -136,8 +136,8 @@ namespace Content.Client.GameObjects.Components
Items = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
CustomMinimumSize = (300, 250)
VerticalExpand = true,
MinSize = (300, 250)
};
vBox.AddChild(Items);
Items.OnItemSelected += ItemSelected;
@@ -202,13 +202,13 @@ namespace Content.Client.GameObjects.Components
_slider = new Slider
{
StyleClasses = {styleClass},
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalExpand = true,
VerticalAlignment = VAlignment.Center,
MaxValue = byte.MaxValue
};
_textBox = new LineEdit
{
CustomMinimumSize = (50, 0)
MinSize = (50, 0)
};
AddChild(new HBoxContainer
@@ -261,18 +261,17 @@ namespace Content.Client.GameObjects.Components
private readonly HairStylePicker _hairStylePicker;
private readonly FacialHairStylePicker _facialHairStylePicker;
protected override Vector2? CustomSize => (500, 360);
public MagicMirrorWindow(MagicMirrorBoundUserInterface owner)
{
SetSize = MinSize = (500, 360);
Title = Loc.GetString("Magic Mirror");
_hairStylePicker = new HairStylePicker {SizeFlagsHorizontal = SizeFlags.FillExpand};
_hairStylePicker = new HairStylePicker {HorizontalExpand = true};
_hairStylePicker.Populate();
_hairStylePicker.OnHairStylePicked += newStyle => owner.HairSelected(newStyle, false);
_hairStylePicker.OnHairColorPicked += newColor => owner.HairColorSelected(newColor, false);
_facialHairStylePicker = new FacialHairStylePicker {SizeFlagsHorizontal = SizeFlags.FillExpand};
_facialHairStylePicker = new FacialHairStylePicker {HorizontalExpand = true};
_facialHairStylePicker.Populate();
_facialHairStylePicker.OnHairStylePicked += newStyle => owner.HairSelected(newStyle, true);
_facialHairStylePicker.OnHairColorPicked += newColor => owner.HairColorSelected(newColor, true);

View File

@@ -14,10 +14,10 @@ namespace Content.Client.GameObjects.Components.MedicalScanner
{
public readonly Button ScanButton;
private readonly Label _diagnostics;
protected override Vector2? CustomSize => (485, 90);
public MedicalScannerWindow()
{
MinSize = SetSize = (485, 90);
Contents.AddChild(new VBoxContainer
{
Children =

View File

@@ -40,7 +40,7 @@ namespace Content.Client.GameObjects.Components.Observer
(new Control()
{
CustomMinimumSize = (20, 0)
MinSize = (20, 0)
}),
(DenyButton = new Button

View File

@@ -3,7 +3,7 @@
<RichTextLabel Name="Title" />
<HBoxContainer SeparationOverride="10">
<RichTextLabel Name="Description" SizeFlagsHorizontal="FillExpand" />
<RichTextLabel Name="Description" HorizontalExpand="True" />
<Button Name="RequestButton" Text="Request" TextAlign="Center" SizeFlagsHorizontal="ShrinkEnd" />
</HBoxContainer>
</VBoxContainer>

View File

@@ -1,10 +1,10 @@
<SS14Window Title="Ghost Roles"
xmlns="https://spacestation14.io">
<CenterContainer Name="NoRolesMessage" SizeFlagsVertical="FillExpand" SizeFlagsHorizontal="FillExpand">
xmlns="https://spacestation14.io" MinSize="350 275">
<CenterContainer Name="NoRolesMessage" VerticalExpand="True" HorizontalExpand="True">
<Label Text="There are currently no available ghost roles." />
</CenterContainer>
<ScrollContainer SizeFlagsHorizontal="FillExpand" SizeFlagsVertical="FillExpand">
<VBoxContainer Name="EntryContainer" SizeFlagsHorizontal="FillExpand" SizeFlagsVertical="FillExpand" />
<ScrollContainer HorizontalExpand="True" VerticalExpand="True">
<VBoxContainer Name="EntryContainer" HorizontalExpand="True" VerticalExpand="True" />
</ScrollContainer>
</SS14Window>

View File

@@ -12,8 +12,6 @@ namespace Content.Client.GameObjects.Components.Observer.GhostRoles
{
public event Action<uint> RoleRequested;
protected override Vector2 CalculateMinimumSize() => (350, 275);
public void ClearEntries()
{
EntryContainer.DisposeAllChildren();

View File

@@ -8,11 +8,11 @@
</HBoxContainer>
<HBoxContainer>
<Label Name="RoleNameLabel" Text="Role Name" />
<LineEdit Name="RoleName" SizeFlagsHorizontal="FillExpand" />
<LineEdit Name="RoleName" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Name="RoleDescriptionLabel" Text="Role Description" />
<LineEdit Name="RoleDescription" SizeFlagsHorizontal="FillExpand" />
<LineEdit Name="RoleDescription" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Name="MakeSentientLabel" Text="Make Sentient" />

View File

@@ -16,12 +16,12 @@ namespace Content.Client.GameObjects.Components.Observer.GhostRoles
{
RobustXamlLoader.Load(this);
MakeSentientLabel.CustomMinimumSize = (150, 0);
RoleEntityLabel.CustomMinimumSize = (150, 0);
RoleNameLabel.CustomMinimumSize = (150, 0);
RoleName.CustomMinimumSize = (300, 0);
RoleDescriptionLabel.CustomMinimumSize = (150, 0);
RoleDescription.CustomMinimumSize = (300, 0);
MakeSentientLabel.MinSize = (150, 0);
RoleEntityLabel.MinSize = (150, 0);
RoleNameLabel.MinSize = (150, 0);
RoleName.MinSize = (300, 0);
RoleDescriptionLabel.MinSize = (150, 0);
RoleDescription.MinSize = (300, 0);
MakeButton.OnPressed += OnPressed;
}

View File

@@ -221,8 +221,6 @@ namespace Content.Client.GameObjects.Components.PDA
private class PDAMenu : SS14Window
{
protected override Vector2? CustomSize => (512, 256);
private PDABoundUserInterface _owner { get; }
public Button FlashLightToggleButton { get; }
@@ -275,6 +273,8 @@ namespace Content.Client.GameObjects.Components.PDA
public PDAMenu(PDABoundUserInterface owner, IPrototypeManager prototypeManager)
{
MinSize = SetSize = (512, 256);
_owner = owner;
_prototypeManager = prototypeManager;
Title = Loc.GetString("PDA");
@@ -287,20 +287,20 @@ namespace Content.Client.GameObjects.Components.PDA
IDInfoLabel = new RichTextLabel()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
};
EjectIDButton = new Button
{
Text = Loc.GetString("Eject ID"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
EjectPenButton = new Button
{
Text = Loc.GetString("Eject Pen"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
var innerHBoxContainer = new HBoxContainer
@@ -315,7 +315,6 @@ namespace Content.Client.GameObjects.Components.PDA
IDInfoContainer = new PanelContainer
{
SizeFlagsHorizontal = SizeFlags.Fill,
Children =
{
innerHBoxContainer,
@@ -330,9 +329,9 @@ namespace Content.Client.GameObjects.Components.PDA
var mainMenuTabContainer = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
CustomMinimumSize = (50, 50),
VerticalExpand = true,
HorizontalExpand = true,
MinSize = (50, 50),
Children =
{
@@ -352,36 +351,36 @@ namespace Content.Client.GameObjects.Components.PDA
BalanceInfo = new RichTextLabel
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
};
//Red background container.
var masterPanelContainer = new PanelContainer
{
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Black },
SizeFlagsVertical = SizeFlags.FillExpand
VerticalExpand = true
};
//This contains both the panel of the category buttons and the listings box.
CategoryAndListingsContainer = new HSplitContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
};
var uplinkShopScrollContainer = new ScrollContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 256)
MinSize = (100, 256)
};
//Add the category list to the left side. The store items to center.
var categoryListContainerBackground = new PanelContainer
{
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.02f) },
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
CategoryListContainer
@@ -395,16 +394,16 @@ namespace Content.Client.GameObjects.Components.PDA
//Actual list of buttons for buying a listing from the uplink.
UplinkListingsContainer = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 256),
MinSize = (100, 256),
};
uplinkShopScrollContainer.AddChild(UplinkListingsContainer);
var innerVboxContainer = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
@@ -472,7 +471,7 @@ namespace Content.Client.GameObjects.Components.PDA
{
Text = listing.ListingName == string.Empty ? prototype.Name : listing.ListingName,
ToolTip = listing.Description == string.Empty ? prototype.Description : listing.Description,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Modulate = _loggedInUplinkAccount.DataBalance >= listing.Price
? Color.White
: Color.Gray.WithAlpha(0.30f)
@@ -481,7 +480,7 @@ namespace Content.Client.GameObjects.Components.PDA
var priceLabel = new Label
{
Text = $"{listing.Price} TC",
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
HorizontalAlignment = HAlignment.Right,
Modulate = _loggedInUplinkAccount.DataBalance >= listing.Price
? weightedColor
: Color.Gray.WithAlpha(0.30f)
@@ -490,8 +489,7 @@ namespace Content.Client.GameObjects.Components.PDA
//Padding for the price lable.
var pricePadding = new HBoxContainer
{
CustomMinimumSize = (32, 1),
SizeFlagsHorizontal = SizeFlags.Fill,
MinSize = (32, 1),
};
//Contains the name of the item and its price. Used for spacing item name and price.
@@ -516,7 +514,6 @@ namespace Content.Client.GameObjects.Components.PDA
var pdaUplinkListingButton = new PDAUplinkItemButton
{
ButtonListing = listing,
SizeFlagsVertical = SizeFlags.Fill,
Children =
{
listingButtonPanelContainer

View File

@@ -10,10 +10,10 @@ namespace Content.Client.GameObjects.Components.Paper
{
private readonly RichTextLabel _label;
public readonly LineEdit Input;
protected override Vector2? CustomSize => (300, 300);
public PaperWindow()
{
MinSize = SetSize = (300, 300);
var container = new VBoxContainer();
_label = new RichTextLabel();
Input = new LineEdit {Visible = false};

View File

@@ -151,7 +151,7 @@ namespace Content.Client.GameObjects.Components.Power
var chargeLabel = new Label {Text = "Charge:"};
ChargeBar = new ProgressBar
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
MinValue = 0.0f,
MaxValue = 1.0f,
Page = 0.0f,

View File

@@ -139,18 +139,14 @@ namespace Content.Client.GameObjects.Components.Power
rows.AddChild(new Label {Text = "Press Enter to confirm."});
rows.AddChild(new Label {Text = ""});
PanelRotation.SizeFlagsHorizontal = SizeFlags.FillExpand;
PanelVelocity.SizeFlagsHorizontal = SizeFlags.FillExpand;
rows.SizeFlagsHorizontal = SizeFlags.Fill;
rows.SizeFlagsVertical = SizeFlags.Fill;
PanelRotation.HorizontalExpand = true;
PanelVelocity.HorizontalExpand = true;
NotARadar = new SolarControlNotARadar(igt);
var outerColumns = new HBoxContainer();
outerColumns.AddChild(rows);
outerColumns.AddChild(NotARadar);
outerColumns.SizeFlagsHorizontal = SizeFlags.Fill;
outerColumns.SizeFlagsVertical = SizeFlags.Fill;
Contents.AddChild(outerColumns);
Resizable = false;
}
@@ -173,6 +169,7 @@ namespace Content.Client.GameObjects.Components.Power
public SolarControlNotARadar(IGameTiming igt)
{
_gameTiming = igt;
MinSize = (SizeFull, SizeFull);
}
public void UpdateState(SolarControlConsoleBoundInterfaceState ls)
@@ -181,11 +178,6 @@ namespace Content.Client.GameObjects.Components.Power
_lastStateTime = _gameTiming.CurTime;
}
protected override Vector2 CalculateMinimumSize()
{
return (SizeFull, SizeFull);
}
protected override void Draw(DrawingHandleScreen handle)
{
int point = SizeFull / 2;

View File

@@ -14,11 +14,11 @@ namespace Content.Client.GameObjects.Components.Research
private int[] _serverIds = new int[]{};
private int _selectedServerId = -1;
protected override Vector2? CustomSize => (300, 300);
public ResearchClientBoundUserInterface Owner { get; set; }
public ResearchClientServerSelectionMenu()
{
MinSize = SetSize = (300, 300);
IoCManager.InjectDependencies(this);
Title = Loc.GetString("Research Server Selection");
@@ -28,19 +28,7 @@ namespace Content.Client.GameObjects.Components.Research
_servers.OnItemSelected += OnItemSelected;
_servers.OnItemDeselected += OnItemDeselected;
var margin = new MarginContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
/*MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,*/
};
margin.AddChild(_servers);
Contents.AddChild(margin);
Contents.AddChild(_servers);
}
public void OnItemSelected(ItemList.ItemListSelectedEventArgs itemListSelectedEventArgs)

View File

@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components.Storage
public override void Initialize()
{
base.Initialize();
// Hide stackVisualizer on start
_bagState = SharedBagState.Close;
}
@@ -132,7 +132,7 @@ namespace Content.Client.GameObjects.Components.Storage
private void ToggleUI()
{
if (Window.IsOpen)
Window.Close();
else
Window.Open();
@@ -142,7 +142,7 @@ namespace Content.Client.GameObjects.Components.Storage
{
Window.Close();
}
private void ChangeStorageVisualization(SharedBagState state)
{
_bagState = state;
@@ -186,25 +186,20 @@ namespace Content.Client.GameObjects.Components.Storage
private readonly StyleBoxFlat _hoveredBox = new() { BackgroundColor = Color.Black.WithAlpha(0.35f) };
private readonly StyleBoxFlat _unHoveredBox = new() { BackgroundColor = Color.Black.WithAlpha(0.0f) };
protected override Vector2? CustomSize => (180, 320);
public StorageWindow()
{
MinSize = SetSize = (180, 320);
Title = "Storage Item";
RectClipContent = true;
var containerButton = new ContainerButton
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
MouseFilter = MouseFilterMode.Pass,
};
var innerContainerButton = new PanelContainer
{
PanelOverride = _unHoveredBox,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
};
@@ -227,20 +222,20 @@ namespace Content.Client.GameObjects.Components.Storage
_information = new Label
{
Text = "Items: 0 Volume: 0/0 Stuff",
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
};
VSplitContainer.AddChild(_information);
var listScrollContainer = new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
HScrollEnabled = true,
VScrollEnabled = true,
};
_entityList = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
listScrollContainer.AddChild(_entityList);
VSplitContainer.AddChild(listScrollContainer);
@@ -342,8 +337,8 @@ namespace Content.Client.GameObjects.Components.Storage
{
ActualButton = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
ToggleMode = true,
MouseFilter = MouseFilterMode.Stop
};
@@ -352,11 +347,11 @@ namespace Content.Client.GameObjects.Components.Storage
var hBoxContainer = new HBoxContainer();
EntitySpriteView = new SpriteView
{
CustomMinimumSize = new Vector2(32.0f, 32.0f)
MinSize = new Vector2(32.0f, 32.0f)
};
EntityName = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Text = "Backpack",
};
hBoxContainer.AddChild(EntitySpriteView);
@@ -364,11 +359,11 @@ namespace Content.Client.GameObjects.Components.Storage
EntityControl = new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
EntitySize = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Text = "Size 6",
Align = Label.AlignMode.Right,
/*AnchorLeft = 1.0f,

View File

@@ -63,23 +63,24 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientBatteryBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild(new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_bulletsList = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 4
}),
(_noBatteryLabel = new Label
@@ -89,11 +90,11 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
})
}
},
new Control() { CustomMinimumSize = (5,0) },
new Control() { MinSize = (5,0) },
(_ammoCount = new Label
{
StyleClasses = {StyleNano.StyleClassItemStatus},
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
HorizontalAlignment = HAlignment.Right,
}),
}
});
@@ -134,7 +135,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
BackgroundColor = colorGone,
},
CustomMinimumSize = (10, 15),
MinSize = (10, 15),
});
}
@@ -148,15 +149,10 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
BackgroundColor = color,
},
CustomMinimumSize = (10, 15),
MinSize = (10, 15),
});
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -73,30 +73,31 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientBoltActionBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild(new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalExpand = true,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0,
Children =
{
(_bulletsListTop = new HBoxContainer {SeparationOverride = 0}),
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_bulletsListBottom = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0
}),
(_noMagazineLabel = new Label
@@ -109,8 +110,8 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
(_chamberedBullet = new TextureRect
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered.png"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill,
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Right,
})
}
}
@@ -198,11 +199,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
altColor ^= true;
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -146,30 +146,31 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientMagazineBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild(new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_chamberedBullet = new TextureRect
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered_rotated.png"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill,
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Right,
}),
new Control() { CustomMinimumSize = (5,0) },
new Control() { MinSize = (5,0) },
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_bulletsList = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0
}),
(_noMagazineLabel = new Label
@@ -179,11 +180,11 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
})
}
},
new Control() { CustomMinimumSize = (5,0) },
new Control() { MinSize = (5,0) },
(_ammoCount = new Label
{
StyleClasses = {StyleNano.StyleClassItemStatus},
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
HorizontalAlignment = HAlignment.Right,
}),
}
});
@@ -232,8 +233,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
Texture = texture,
ModulateSelfOverride = altColor ? colorGoneA : colorGoneB,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Stretch = TextureRect.StretchMode.KeepCentered
});
@@ -248,8 +247,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
Texture = texture,
ModulateSelfOverride = altColor ? colorA : colorB,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Stretch = TextureRect.StretchMode.KeepCentered
});
@@ -257,11 +254,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
public void PlayAlarmAnimation()
{
var animation = _parent._isLmgAlarmAnimation ? AlarmAnimationLmg : AlarmAnimationSmg;

View File

@@ -73,30 +73,31 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientPumpBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild(new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalExpand = true,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0,
Children =
{
(_bulletsListTop = new HBoxContainer {SeparationOverride = 0}),
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_bulletsListBottom = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0
}),
(_noMagazineLabel = new Label
@@ -109,8 +110,8 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
(_chamberedBullet = new TextureRect
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered.png"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill,
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Right,
})
}
}
@@ -198,11 +199,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
altColor ^= true;
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -64,13 +64,14 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientRevolverBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild((_bulletsList = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalExpand = true,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0
}));
}
@@ -119,7 +120,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
// Add a outline
var box = new Control()
{
CustomMinimumSize = texture.Size * scale,
MinSize = texture.Size * scale,
};
if (i == _parent.CurrentSlot)
{
@@ -152,8 +153,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
box.AddChild(new TextureRect
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Stretch = TextureRect.StretchMode.KeepCentered,
Texture = bulletTexture,
ModulateSelfOverride = color,
@@ -162,11 +161,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
container.AddChild(box);
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -72,30 +72,30 @@ namespace Content.Client.GameObjects.Components.Wires
{
new PanelContainer
{
CustomMinimumSize = (2, 0),
MinSize = (2, 0),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
},
new PanelContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
MouseFilter = MouseFilterMode.Stop,
Name = "Shadow",
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.5f)}
},
new PanelContainer
{
CustomMinimumSize = (2, 0),
MinSize = (2, 0),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
},
}
};
var wrappingHBox = new HBoxContainer();
_wiresHBox = new HBoxContainer {SeparationOverride = 4, SizeFlagsVertical = SizeFlags.ShrinkEnd};
_wiresHBox = new HBoxContainer {SeparationOverride = 4, VerticalAlignment = VAlignment.Bottom};
wrappingHBox.AddChild(new Control {CustomMinimumSize = (20, 0)});
wrappingHBox.AddChild(new Control {MinSize = (20, 0)});
wrappingHBox.AddChild(_wiresHBox);
wrappingHBox.AddChild(new Control {CustomMinimumSize = (20, 0)});
wrappingHBox.AddChild(new Control {MinSize = (20, 0)});
bottomWrap.AddChild(bottomPanel);
@@ -128,7 +128,7 @@ namespace Content.Client.GameObjects.Components.Wires
Children =
{
(_topContainer = new VBoxContainer()),
new Control {CustomMinimumSize = (0, 110)}
new Control {MinSize = (0, 110)}
}
};
@@ -140,53 +140,38 @@ namespace Content.Client.GameObjects.Components.Wires
var fontSmall = _resourceCache.GetFont("/Fonts/Boxfont-round/Boxfont Round.ttf", 10);
Button helpButton;
var topRow = new MarginContainer
var topRow = new HBoxContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 2,
MarginRightOverride = 12,
MarginBottomOverride = 2,
Margin = new Thickness(4, 2, 12, 2),
Children =
{
new HBoxContainer
(_nameLabel = new Label
{
Children =
{
(_nameLabel = new Label
{
Text = Loc.GetString("Wires"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
SizeFlagsVertical = SizeFlags.ShrinkCenter
}),
new Control
{
CustomMinimumSize = (8, 0),
},
(_serialLabel = new Label
{
Text = Loc.GetString("DEAD-BEEF"),
FontOverride = fontSmall,
FontColorOverride = Color.Gray,
SizeFlagsVertical = SizeFlags.ShrinkCenter
}),
new Control
{
CustomMinimumSize = (20, 0),
SizeFlagsHorizontal = SizeFlags.Expand
},
(helpButton = new Button {Text = "?"}),
new Control
{
CustomMinimumSize = (2, 0),
},
(CloseButton = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
SizeFlagsVertical = SizeFlags.ShrinkCenter
})
}
}
Text = Loc.GetString("Wires"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
VerticalAlignment = VAlignment.Center,
}),
(_serialLabel = new Label
{
Text = Loc.GetString("DEAD-BEEF"),
FontOverride = fontSmall,
FontColorOverride = Color.Gray,
VerticalAlignment = VAlignment.Center,
Margin = new Thickness(8, 0, 20, 0),
HorizontalAlignment = HAlignment.Left,
HorizontalExpand = true,
}),
(helpButton = new Button
{
Text = "?",
Margin = new Thickness(0, 0, 2, 0),
}),
(CloseButton = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
VerticalAlignment = VAlignment.Center
})
}
};
@@ -207,21 +192,12 @@ namespace Content.Client.GameObjects.Components.Wires
{
Children =
{
new MarginContainer
(_statusContainer = new GridContainer
{
MarginLeftOverride = 8,
MarginRightOverride = 8,
MarginTopOverride = 4,
MarginBottomOverride = 4,
Children =
{
(_statusContainer = new GridContainer
{
// TODO: automatically change columns count.
Columns = 3
})
}
}
Margin = new Thickness(8, 4),
// TODO: automatically change columns count.
Columns = 3
})
}
}
}
@@ -230,17 +206,17 @@ namespace Content.Client.GameObjects.Components.Wires
_topContainer.AddChild(topRow);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
_topContainer.AddChild(middle);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
CloseButton.OnPressed += _ => Close();
LayoutContainer.SetSize(this, (300, 200));
SetSize = (320, 200);
}
@@ -258,7 +234,7 @@ namespace Content.Client.GameObjects.Components.Wires
var type = random.Next(2);
var control = new WireControl(wire.Color, wire.Letter, wire.IsCut, flip, mirror, type, _resourceCache)
{
SizeFlagsVertical = SizeFlags.ShrinkEnd
VerticalAlignment = VAlignment.Bottom
};
_wiresHBox.AddChild(control);
@@ -313,11 +289,12 @@ namespace Content.Client.GameObjects.Components.Wires
public event Action WireClicked;
public event Action ContactsClicked;
public WireControl(WireColor color, WireLetter letter, bool isCut, bool flip, bool mirror, int type, IResourceCache resourceCache)
public WireControl(WireColor color, WireLetter letter, bool isCut, bool flip, bool mirror, int type,
IResourceCache resourceCache)
{
_resourceCache = resourceCache;
SizeFlagsHorizontal = SizeFlags.ShrinkCenter;
HorizontalAlignment = HAlignment.Center;
MouseFilter = MouseFilterMode.Stop;
var layout = new LayoutContainer();
@@ -326,8 +303,8 @@ namespace Content.Client.GameObjects.Components.Wires
var greek = new Label
{
Text = letter.Letter().ToString(),
SizeFlagsVertical = SizeFlags.ShrinkEnd,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Bottom,
HorizontalAlignment = HAlignment.Center,
Align = Label.AlignMode.Center,
FontOverride = _resourceCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 12),
FontColorOverride = Color.Gray,
@@ -365,14 +342,9 @@ namespace Content.Client.GameObjects.Components.Wires
LayoutContainer.SetPosition(wire, (2, 16));
ToolTip = color.Name();
MinSize = (20, 102);
}
protected override Vector2 CalculateMinimumSize()
{
return (20, 102);
}
protected override void KeyBindDown(GUIBoundKeyEventArgs args)
{
base.KeyBindDown(args);
@@ -425,7 +397,8 @@ namespace Content.Client.GameObjects.Components.Wires
private readonly IResourceCache _resourceCache;
public WireRender(WireColor color, bool isCut, bool flip, bool mirror, int type, IResourceCache resourceCache)
public WireRender(WireColor color, bool isCut, bool flip, bool mirror, int type,
IResourceCache resourceCache)
{
_resourceCache = resourceCache;
_color = color;
@@ -433,11 +406,8 @@ namespace Content.Client.GameObjects.Components.Wires
_flip = flip;
_mirror = mirror;
_type = type;
}
protected override Vector2 CalculateMinimumSize()
{
return (16, 50);
SetSize = (16, 50);
}
protected override void Draw(DrawingHandleScreen handle)
@@ -529,6 +499,7 @@ namespace Content.Client.GameObjects.Components.Wires
var lightContainer = new Control
{
SetSize = (20, 20),
Children =
{
new TextureRect
@@ -588,10 +559,10 @@ namespace Content.Client.GameObjects.Components.Wires
Text = data.Text,
FontOverride = font,
FontColorOverride = Color.FromHex("#A1A6AE"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
});
hBox.AddChild(lightContainer);
hBox.AddChild(new Control {CustomMinimumSize = (6, 0)});
hBox.AddChild(new Control {MinSize = (6, 0)});
AddChild(hBox);
}
}

View File

@@ -69,7 +69,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
var doAfterBar = new DoAfterBar
{
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
};
_doAfterBars[message.ID] = doAfterBar;
@@ -82,7 +82,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/Misc/progress_bar.rsi/icon.png"),
TextureScale = Vector2.One * DoAfterBar.DoAfterBarScale,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
},
doAfterBar

View File

@@ -90,10 +90,11 @@ namespace Content.Client.GameObjects.EntitySystems
hBox.AddChild(new Label
{
Text = entity.Name,
SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
HorizontalExpand = true,
});
var size = Vector2.ComponentMax((minWidth, 0), panel.CombinedMinimumSize);
panel.Measure(Vector2.Infinity);
var size = Vector2.ComponentMax((minWidth, 0), panel.DesiredSize);
_examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos, size));

View File

@@ -26,14 +26,14 @@ namespace Content.Client.GameObjects.EntitySystems.HealthOverlay
CritBar = new HealthOverlayBar
{
Visible = false,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Color = Color.Red
};
HealthBar = new HealthOverlayBar
{
Visible = false,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Color = Color.Green
};
@@ -45,7 +45,7 @@ namespace Content.Client.GameObjects.EntitySystems.HealthOverlay
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/Misc/health_bar.rsi/icon.png"),
TextureScale = Vector2.One * HealthOverlayBar.HealthBarScale,
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center,
},
CritBar,
HealthBar

View File

@@ -164,7 +164,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
_currentEntityList.List.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}
@@ -176,7 +176,8 @@ namespace Content.Client.GameObjects.EntitySystems
_userInterfaceManager.ModalRoot.AddChild(_currentEntityList);
var size = _currentEntityList.List.CombinedMinimumSize;
_currentEntityList.List.Measure(Vector2.Infinity);
var size = _currentEntityList.List.DesiredSize;
var box = UIBox2.FromDimensions(_userInterfaceManager.MousePositionScaled, size);
_currentEntityList.Open(box);
@@ -284,7 +285,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
vBox.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}
@@ -306,7 +307,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
vBox.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}
@@ -449,11 +450,11 @@ namespace Content.Client.GameObjects.EntitySystems
{
text = $"{text} ({entity.Uid})";
}
control.AddChild(new MarginContainer
control.AddChild(new Label
{
MarginLeftOverride = 4,
MarginRightOverride = 4,
Children = {new Label {Text = text}}
Margin = new Thickness(4, 0),
Text = text
});
AddChild(control);
@@ -486,7 +487,8 @@ namespace Content.Client.GameObjects.EntitySystems
var func = args.Function;
var funcId = _master._inputManager.NetworkBindMap.KeyFunctionID(args.Function);
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction, funcId, BoundKeyState.Down,
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction,
funcId, BoundKeyState.Down,
_entity.Transform.Coordinates,
args.PointerLocation, _entity.Uid);
@@ -546,12 +548,12 @@ namespace Content.Client.GameObjects.EntitySystems
{
(_icon = new TextureRect
{
CustomMinimumSize = (32, 32),
MinSize = (32, 32),
Stretch = TextureRect.StretchMode.KeepCentered
}),
(_label = new Label()),
// Padding
new Control {CustomMinimumSize = (8, 0)}
new Control {MinSize = (8, 0)}
}
});
}
@@ -603,17 +605,17 @@ namespace Content.Client.GameObjects.EntitySystems
{
(_icon = new TextureRect
{
CustomMinimumSize = (32, 32),
MinSize = (32, 32),
Stretch = TextureRect.StretchMode.KeepCentered
}),
(_label = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
}),
// Padding
new Control {CustomMinimumSize = (8, 0)},
new Control {MinSize = (8, 0)},
new TextureRect
{
@@ -662,7 +664,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
popup.List.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}