diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs index b63977d08c..554d1fd918 100644 --- a/Content.Client/Chat/ChatBox.cs +++ b/Content.Client/Chat/ChatBox.cs @@ -50,13 +50,13 @@ namespace Content.Client.Chat public ChatBox() { - MarginLeft = -475.0f; + /*MarginLeft = -475.0f; MarginTop = 10.0f; MarginRight = -10.0f; MarginBottom = 235.0f; AnchorLeft = 1.0f; - AnchorRight = 1.0f; + AnchorRight = 1.0f;*/ var outerVBox = new VBoxContainer(); diff --git a/Content.Client/Chat/ChatManager.cs b/Content.Client/Chat/ChatManager.cs index 70b46b3f4a..e0ee549fbd 100644 --- a/Content.Client/Chat/ChatManager.cs +++ b/Content.Client/Chat/ChatManager.cs @@ -81,11 +81,11 @@ namespace Content.Client.Chat { _netManager.RegisterNetMessage(MsgChatMessage.NAME, _onChatMessage); - _speechBubbleRoot = new Control + _speechBubbleRoot = new LayoutContainer { MouseFilter = Control.MouseFilterMode.Ignore }; - _speechBubbleRoot.SetAnchorPreset(Control.LayoutPreset.Wide); + LayoutContainer.SetAnchorPreset(_speechBubbleRoot, LayoutContainer.LayoutPreset.Wide); _userInterfaceManager.StateRoot.AddChild(_speechBubbleRoot); _speechBubbleRoot.SetPositionFirst(); } diff --git a/Content.Client/Chat/SpeechBubble.cs b/Content.Client/Chat/SpeechBubble.cs index 61aa4e0bbe..01453c12f0 100644 --- a/Content.Client/Chat/SpeechBubble.cs +++ b/Content.Client/Chat/SpeechBubble.cs @@ -31,8 +31,6 @@ namespace Content.Client.Chat private readonly IEntity _senderEntity; private readonly IChatManager _chatManager; - private readonly Control _panel; - private float _timeLeft = TotalTime; public float VerticalOffset { get; set; } @@ -57,7 +55,7 @@ namespace Content.Client.Chat }; label.SetMessage(text); - _panel = new PanelContainer + var panel = new PanelContainer { StyleClasses = { "tooltipBox" }, Children = { label }, @@ -65,16 +63,19 @@ namespace Content.Client.Chat ModulateSelfOverride = Color.White.WithAlpha(0.75f) }; - AddChild(_panel); + AddChild(panel); ForceRunStyleUpdate(); - _panel.Size = _panel.CombinedMinimumSize; - ContentHeight = _panel.Height; - Size = (_panel.Width, 0); + ContentHeight = panel.CombinedMinimumSize.Y; _verticalOffsetAchieved = -ContentHeight; } + protected override Vector2 CalculateMinimumSize() + { + return (base.CalculateMinimumSize().X, 0); + } + protected override void FrameUpdate(FrameEventArgs args) { base.FrameUpdate(args); @@ -109,10 +110,10 @@ namespace Content.Client.Chat var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale; var screenPos = lowerCenter - (Width / 2, ContentHeight + _verticalOffsetAchieved); - Position = screenPos; + LayoutContainer.SetPosition(this, screenPos); var height = (lowerCenter.Y - screenPos.Y).Clamp(0, ContentHeight); - Size = (Size.X, height); + LayoutContainer.SetSize(this, (Size.X, height)); } private void Die() diff --git a/Content.Client/ClientNotifyManager.cs b/Content.Client/ClientNotifyManager.cs index 81a2d199b1..4fba8f5f10 100644 --- a/Content.Client/ClientNotifyManager.cs +++ b/Content.Client/ClientNotifyManager.cs @@ -59,7 +59,7 @@ namespace Content.Client { var label = new PopupLabel {Text = message}; var minimumSize = label.CombinedMinimumSize; - label.InitialPos = label.Position = coordinates.Position - minimumSize / 2; + LayoutContainer.SetPosition(label, label.InitialPos = coordinates.Position - minimumSize / 2); _userInterfaceManager.PopupRoot.AddChild(label); _aliveLabels.Add(label); } @@ -94,7 +94,7 @@ namespace Content.Client public void Update(FrameEventArgs eventArgs) { _timeLeft += eventArgs.DeltaSeconds; - Position = InitialPos - new Vector2(0, 20 * (_timeLeft * _timeLeft + _timeLeft)); + LayoutContainer.SetPosition(this, InitialPos - (0, 20 * (_timeLeft * _timeLeft + _timeLeft))); if (_timeLeft > 0.5f) { Modulate = Color.White.WithAlpha(1f - 0.2f * (float)Math.Pow(_timeLeft - 0.5f, 3f)); diff --git a/Content.Client/Construction/ConstructionMenu.cs b/Content.Client/Construction/ConstructionMenu.cs index c5c727f091..14502f26bb 100644 --- a/Content.Client/Construction/ConstructionMenu.cs +++ b/Content.Client/Construction/ConstructionMenu.cs @@ -41,10 +41,10 @@ namespace Content.Client.Construction private List FlattenedCategories; private readonly PlacementManager Placement; + protected override Vector2? CustomSize => (500, 350); + public ConstructionMenu() { - Size = (500, 350); - IoCManager.InjectDependencies(this); Placement = (PlacementManager) IoCManager.Resolve(); Placement.PlacementCanceled += OnPlacementCanceled; diff --git a/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs b/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs index b468e9ffdc..789d428a03 100644 --- a/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs +++ b/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs @@ -124,8 +124,6 @@ namespace Content.Client.GameObjects.Components.Actor { _contentsVBox.AddChild(element.Scene); } - - Size = CombinedMinimumSize; } } } diff --git a/Content.Client/GameObjects/Components/Chemistry/ReagentDispenserBoundUserInterface.cs b/Content.Client/GameObjects/Components/Chemistry/ReagentDispenserBoundUserInterface.cs index 29c92fc658..f747a1388f 100644 --- a/Content.Client/GameObjects/Components/Chemistry/ReagentDispenserBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Chemistry/ReagentDispenserBoundUserInterface.cs @@ -42,7 +42,6 @@ namespace Content.Client.GameObjects.Components.Chemistry _window = new ReagentDispenserWindow { Title = _localizationManager.GetString("Reagent dispenser"), - Size = (500, 600) }; _window.OpenCenteredMinSize(); diff --git a/Content.Client/GameObjects/Components/Chemistry/ReagentDispenserWindow.cs b/Content.Client/GameObjects/Components/Chemistry/ReagentDispenserWindow.cs index 60e044d64d..d35b18346c 100644 --- a/Content.Client/GameObjects/Components/Chemistry/ReagentDispenserWindow.cs +++ b/Content.Client/GameObjects/Components/Chemistry/ReagentDispenserWindow.cs @@ -55,6 +55,8 @@ namespace Content.Client.GameObjects.Components.Chemistry [Dependency] private readonly ILocalizationManager _localizationManager; #pragma warning restore 649 + protected override Vector2? CustomSize => (500, 600); + /// /// 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. @@ -118,7 +120,6 @@ namespace Content.Client.GameObjects.Components.Chemistry //Currently empty, when server sends state data this will have container contents and fill volume. (ContainerInfo = new VBoxContainer { - MarginLeft = 5.0f, SizeFlagsHorizontal = SizeFlags.FillExpand, Children = { diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs index f77e7f113e..9f5a2fb9b5 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs @@ -165,17 +165,16 @@ namespace Content.Client.GameObjects const int width = ButtonSize * 4 + ButtonSeparation * 3 + RightSeparation; const int height = ButtonSize * 4 + ButtonSeparation * 3; - var windowContents = new Control {CustomMinimumSize = (width, height)}; + var windowContents = new LayoutContainer {CustomMinimumSize = (width, height)}; Contents.AddChild(windowContents); void AddButton(Slots slot, string textureName, Vector2 position) { var texture = resourceCache.GetTexture($"/Textures/UserInterface/Inventory/{textureName}.png"); var storageTexture = resourceCache.GetTexture("/Textures/UserInterface/Inventory/back.png"); - var button = new InventoryButton(slot, texture, storageTexture) - { - Position = position - }; + var button = new InventoryButton(slot, texture, storageTexture); + + LayoutContainer.SetPosition(button, position); windowContents.AddChild(button); buttonDict.Add(slot, button); @@ -206,8 +205,6 @@ namespace Content.Client.GameObjects AddButton(Slots.BELT, "belt", (rSep + 3 * (size + sep), size + sep)); AddButton(Slots.POCKET1, "pocket", (rSep + 3 * (size + sep), 2 * (size + sep))); AddButton(Slots.POCKET2, "pocket", (rSep + 3 * (size + sep), 3 * (size + sep))); - - Size = CombinedMinimumSize; } } } diff --git a/Content.Client/GameObjects/Components/MagicMirrorBoundUserInterface.cs b/Content.Client/GameObjects/Components/MagicMirrorBoundUserInterface.cs index 6e6de6e31b..b07fa2c05d 100644 --- a/Content.Client/GameObjects/Components/MagicMirrorBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/MagicMirrorBoundUserInterface.cs @@ -171,8 +171,6 @@ namespace Content.Client.GameObjects.Components }; facialHairButton.OnPressed += args => _facialHairPickerWindow.Open(); vBox.AddChild(facialHairButton); - - Size = CombinedMinimumSize; } protected override void Dispose(bool disposing) diff --git a/Content.Client/GameObjects/Components/MedicalScanner/MedicalScannerBoundUserInterface.cs b/Content.Client/GameObjects/Components/MedicalScanner/MedicalScannerBoundUserInterface.cs index ff256a4f14..135a55f992 100644 --- a/Content.Client/GameObjects/Components/MedicalScanner/MedicalScannerBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/MedicalScanner/MedicalScannerBoundUserInterface.cs @@ -18,7 +18,6 @@ namespace Content.Client.GameObjects.Components.MedicalScanner _window = new MedicalScannerWindow { Title = Owner.Owner.Name, - Size = (485, 90), }; _window.OnClose += Close; _window.OpenCentered(); diff --git a/Content.Client/GameObjects/Components/MedicalScanner/MedicalScannerWindow.cs b/Content.Client/GameObjects/Components/MedicalScanner/MedicalScannerWindow.cs index 604442693d..58e72a875e 100644 --- a/Content.Client/GameObjects/Components/MedicalScanner/MedicalScannerWindow.cs +++ b/Content.Client/GameObjects/Components/MedicalScanner/MedicalScannerWindow.cs @@ -4,12 +4,15 @@ using Robust.Shared.Utility; using System.Text; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; +using Robust.Shared.Maths; using static Content.Shared.GameObjects.Components.Medical.SharedMedicalScannerComponent; namespace Content.Client.GameObjects.Components.MedicalScanner { public class MedicalScannerWindow : SS14Window { + protected override Vector2? CustomSize => (485, 90); + public void Populate(MedicalScannerBoundUserInterfaceState state) { Contents.RemoveAllChildren(); diff --git a/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs b/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs index 54aae8fd56..0abeb69183 100644 --- a/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs @@ -21,10 +21,7 @@ namespace Content.Client.GameObjects.Components.Power { base.Open(); - _window = new ApcWindow - { - MarginRight = 426.0f, MarginBottom = 270.0f - }; + _window = new ApcWindow(); _window.OnClose += Close; _window.OpenCenteredMinSize(); diff --git a/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs b/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs index df23f7be5c..f6b39e12da 100644 --- a/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs +++ b/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs @@ -36,10 +36,10 @@ namespace Content.Client.GameObjects.Components.Research { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, - MarginTop = 5f, + /*MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, - MarginBottom = -5f, + MarginBottom = -5f,*/ }; margin.AddChild(_servers); diff --git a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs index b9686d45b7..d7e7069ae8 100644 --- a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs @@ -101,10 +101,10 @@ namespace Content.Client.GameObjects.Components.Storage private Label Information; public ClientStorageComponent StorageEntity; + protected override Vector2? CustomSize => (180, 320); + public StorageWindow() { - Size = (180, 320); - Title = "Storage Item"; RectClipContent = true; @@ -239,14 +239,14 @@ namespace Content.Client.GameObjects.Components.Storage SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "Size 6", Align = Label.AlignMode.Right, - AnchorLeft = 1.0f, + /*AnchorLeft = 1.0f, AnchorRight = 1.0f, AnchorBottom = 0.5f, AnchorTop = 0.5f, MarginLeft = -38.0f, MarginTop = -7.0f, MarginRight = -5.0f, - MarginBottom = 7.0f + MarginBottom = 7.0f*/ }; EntityControl.AddChild(EntitySize); diff --git a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs index 53097731b2..dff2a4069e 100644 --- a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs @@ -86,7 +86,7 @@ namespace Content.Client.GameObjects.EntitySystems panel.AddStyleClass(StyleClassEntityTooltip); panel.ModulateSelfOverride = Color.LightGray.WithAlpha(0.90f); _examineTooltipOpen.AddChild(panel); - panel.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide); + //panel.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide); var vBox = new VBoxContainer(); panel.AddChild(vBox); var hBox = new HBoxContainer { SeparationOverride = 5}; @@ -145,7 +145,7 @@ namespace Content.Client.GameObjects.EntitySystems } } - _examineTooltipOpen.Position += Vector2.ComponentMin(Vector2.Zero,_userInterfaceManager.StateRoot.Size - (panel.Size + _examineTooltipOpen.Position)); + //_examineTooltipOpen.Position += Vector2.ComponentMin(Vector2.Zero,_userInterfaceManager.StateRoot.Size - (panel.Size + _examineTooltipOpen.Position)); } public void CloseTooltip() diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index 9dfbebd8d6..01a76e40a4 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -198,14 +198,14 @@ namespace Content.Client.GameObjects.EntitySystems vBox.AddChild(panel); } - _currentPopup.Size = vBox.CombinedMinimumSize; + //_currentPopup.Size = vBox.CombinedMinimumSize; // If we're at the bottom of the window and the menu would go below the bottom of the window, // shift it up so it extends UP. var bottomCoords = vBox.CombinedMinimumSize.Y + _currentPopup.Position.Y; if (bottomCoords > _userInterfaceManager.StateRoot.Size.Y) { - _currentPopup.Position = _currentPopup.Position - new Vector2(0, vBox.CombinedMinimumSize.Y); + // _currentPopup.Position = _currentPopup.Position - new Vector2(0, vBox.CombinedMinimumSize.Y); } } diff --git a/Content.Client/GameTicking/ClientGameTicker.cs b/Content.Client/GameTicking/ClientGameTicker.cs index 8b09cb4db0..2e60f19f53 100644 --- a/Content.Client/GameTicking/ClientGameTicker.cs +++ b/Content.Client/GameTicking/ClientGameTicker.cs @@ -14,6 +14,7 @@ using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.Interfaces.UserInterface; using Robust.Client.Player; using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; using Robust.Shared.Input; using Robust.Shared.Interfaces.Network; using Robust.Shared.IoC; @@ -191,7 +192,7 @@ namespace Content.Client.GameTicking _lobby = new LobbyGui(_localization, _resourceCache); _userInterfaceManager.StateRoot.AddChild(_lobby); - _lobby.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide, margin: 20); + LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide); _chatManager.SetChatBox(_lobby.Chat); _lobby.Chat.DefaultChatFormat = "ooc \"{0}\""; @@ -246,6 +247,11 @@ namespace Content.Client.GameTicking _gameChat = new ChatBox(); _userInterfaceManager.StateRoot.AddChild(_gameChat); + LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10); + LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10); + LayoutContainer.SetMarginLeft(_gameChat, -475); + LayoutContainer.SetMarginBottom(_gameChat, 235); + _userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl); _chatManager.SetChatBox(_gameChat); _gameChat.DefaultChatFormat = "say \"{0}\""; @@ -261,6 +267,7 @@ namespace Content.Client.GameTicking { return; } + chat.Input.IgnoreNext = true; chat.Input.GrabKeyboardFocus(); } diff --git a/Content.Client/Instruments/InstrumentMenu.cs b/Content.Client/Instruments/InstrumentMenu.cs index 6f00b9695f..9dae5c476a 100644 --- a/Content.Client/Instruments/InstrumentMenu.cs +++ b/Content.Client/Instruments/InstrumentMenu.cs @@ -37,22 +37,14 @@ namespace Content.Client.Instruments { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, - MarginTop = 5f, - MarginLeft = 5f, - MarginRight = -5f, - MarginBottom = -5f, }; - margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); - var vBox = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SeparationOverride = 5, }; - vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); - var hBoxTopButtons = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, diff --git a/Content.Client/Research/LatheMenu.cs b/Content.Client/Research/LatheMenu.cs index 4e99c875bc..2d951a2ff5 100644 --- a/Content.Client/Research/LatheMenu.cs +++ b/Content.Client/Research/LatheMenu.cs @@ -47,22 +47,14 @@ namespace Content.Client.Research { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, - MarginTop = 5f, - MarginLeft = 5f, - MarginRight = -5f, - MarginBottom = -5f, }; - margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); - var vBox = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SeparationOverride = 5, }; - vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); - var hBoxButtons = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, @@ -100,8 +92,6 @@ namespace Content.Client.Research SizeFlagsStretchRatio = 3, }; - spacer.SetAnchorAndMarginPreset(LayoutPreset.Wide); - var hBoxFilter = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, diff --git a/Content.Client/Research/LatheQueueMenu.cs b/Content.Client/Research/LatheQueueMenu.cs index f589c47b97..7c6537c5c5 100644 --- a/Content.Client/Research/LatheQueueMenu.cs +++ b/Content.Client/Research/LatheQueueMenu.cs @@ -27,24 +27,24 @@ namespace Content.Client.Research var margin = new MarginContainer() { - MarginTop = 5f, + /*MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, - MarginBottom = -5f, + MarginBottom = -5f,*/ }; - margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); +// margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); var vBox = new VBoxContainer(); - vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); + // vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); var descMargin = new MarginContainer() { - MarginTop = 5f, + /*MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, - MarginBottom = -5f, + MarginBottom = -5f,*/ SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, }; diff --git a/Content.Client/Sandbox/SandboxWindow.cs b/Content.Client/Sandbox/SandboxWindow.cs index 9520135077..884bbb90ce 100644 --- a/Content.Client/Sandbox/SandboxWindow.cs +++ b/Content.Client/Sandbox/SandboxWindow.cs @@ -38,8 +38,6 @@ namespace Content.Client.Sandbox SpawnTilesButton } }); - - Size = CombinedMinimumSize; } } } diff --git a/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs b/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs index 9db6b0a7ac..cf75374b61 100644 --- a/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs +++ b/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs @@ -59,15 +59,9 @@ namespace Content.Client.UserInterface.Cargo else Title = _loc.GetString("Cargo Shuttle Console"); - var rows = new VBoxContainer - { - MarginTop = 0 - }; + var rows = new VBoxContainer(); - var accountName = new HBoxContainer() - { - MarginTop = 0 - }; + var accountName = new HBoxContainer(); var accountNameLabel = new Label { Text = _loc.GetString("Account Name: "), StyleClasses = { NanoStyle.StyleClassLabelKeyText } @@ -286,7 +280,7 @@ namespace Content.Client.UserInterface.Cargo _orders.RemoveAllChildren(); _requests.RemoveAllChildren(); - foreach (var order in Owner.Orders.Orders) + foreach (var order in Owner.Orders.Orders) { var row = new CargoOrderRow(); row.Order = order; diff --git a/Content.Client/UserInterface/Cargo/GalacticBankSelectionMenu.cs b/Content.Client/UserInterface/Cargo/GalacticBankSelectionMenu.cs index 28ad546ddd..cc4dfb1e83 100644 --- a/Content.Client/UserInterface/Cargo/GalacticBankSelectionMenu.cs +++ b/Content.Client/UserInterface/Cargo/GalacticBankSelectionMenu.cs @@ -38,10 +38,6 @@ namespace Content.Client.UserInterface.Cargo { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, - MarginTop = 5f, - MarginLeft = 5f, - MarginRight = -5f, - MarginBottom = -5f, }; margin.AddChild(_accounts); diff --git a/Content.Client/UserInterface/EscapeMenu.cs b/Content.Client/UserInterface/EscapeMenu.cs index 87d7c8509e..70722f0472 100644 --- a/Content.Client/UserInterface/EscapeMenu.cs +++ b/Content.Client/UserInterface/EscapeMenu.cs @@ -73,8 +73,6 @@ namespace Content.Client.UserInterface QuitButton = new Button {Text = "Quit"}; QuitButton.OnPressed += OnQuitButtonClicked; vBox.AddChild(QuitButton); - - Size = CombinedMinimumSize; } private void OnQuitButtonClicked(BaseButton.ButtonEventArgs args) diff --git a/Content.Client/UserInterface/GameHud.cs b/Content.Client/UserInterface/GameHud.cs index 2475e80ec1..c854b6177a 100644 --- a/Content.Client/UserInterface/GameHud.cs +++ b/Content.Client/UserInterface/GameHud.cs @@ -82,6 +82,7 @@ namespace Content.Client.UserInterface public Control HandsContainer { get; private set; } public Control InventoryQuickButtonContainer { get; private set; } + public bool CombatPanelVisible { get => _combatPanelContainer.Visible; @@ -105,9 +106,8 @@ namespace Content.Client.UserInterface public void Initialize() { - RootControl = new Control {MouseFilter = Control.MouseFilterMode.Ignore}; - - RootControl.SetAnchorPreset(Control.LayoutPreset.Wide); + RootControl = new LayoutContainer {MouseFilter = Control.MouseFilterMode.Ignore}; + LayoutContainer.SetAnchorPreset(RootControl, LayoutContainer.LayoutPreset.Wide); var escapeTexture = _resourceCache.GetTexture("/Textures/UserInterface/hamburger.svg.96dpi.png"); var characterTexture = _resourceCache.GetTexture("/Textures/UserInterface/character.svg.96dpi.png"); @@ -122,7 +122,9 @@ namespace Content.Client.UserInterface }; RootControl.AddChild(_topButtonsContainer); - _topButtonsContainer.SetAnchorAndMarginPreset(Control.LayoutPreset.TopLeft, margin: 10); + + LayoutContainer.SetAnchorAndMarginPreset(_topButtonsContainer, LayoutContainer.LayoutPreset.TopLeft, + margin: 10); // TODO: Pull key names here from the actual key binding config. // Escape @@ -198,25 +200,22 @@ namespace Content.Client.UserInterface var inventoryContainer = new HBoxContainer { - GrowHorizontal = Control.GrowDirection.Begin, - GrowVertical = Control.GrowDirection.Begin, SeparationOverride = 10 }; RootControl.AddChild(inventoryContainer); - inventoryContainer.SetAnchorAndMarginPreset(Control.LayoutPreset.BottomRight); + + LayoutContainer.SetGrowHorizontal(inventoryContainer, LayoutContainer.GrowDirection.Begin); + LayoutContainer.SetGrowVertical(inventoryContainer, LayoutContainer.GrowDirection.Begin); + LayoutContainer.SetAnchorAndMarginPreset(inventoryContainer, LayoutContainer.LayoutPreset.BottomRight); InventoryQuickButtonContainer = new MarginContainer { - GrowHorizontal = Control.GrowDirection.Begin, - GrowVertical = Control.GrowDirection.Begin, SizeFlagsVertical = Control.SizeFlags.ShrinkEnd }; HandsContainer = new MarginContainer { - GrowHorizontal = Control.GrowDirection.Both, - GrowVertical = Control.GrowDirection.Begin, SizeFlagsVertical = Control.SizeFlags.ShrinkEnd }; @@ -337,7 +336,6 @@ namespace Content.Client.UserInterface private static readonly Color ColorHovered = Color.FromHex("#9699bb"); private static readonly Color ColorPressed = Color.FromHex("#789B8C"); - private readonly VBoxContainer _container; private readonly TextureRect _textureRect; private readonly Label _label; @@ -345,38 +343,47 @@ namespace Content.Client.UserInterface { ToggleMode = true; - _container = new VBoxContainer {MouseFilter = MouseFilterMode.Ignore}; - AddChild(_container); - _container.AddChild(_textureRect = new TextureRect + AddChild(new MarginContainer { - Texture = texture, - SizeFlagsHorizontal = SizeFlags.ShrinkCenter, - SizeFlagsVertical = SizeFlags.Expand | SizeFlags.ShrinkCenter, MouseFilter = MouseFilterMode.Ignore, - ModulateSelfOverride = ColorNormal, - CustomMinimumSize = (0, 32), - Stretch = TextureRect.StretchMode.KeepCentered + MarginTopOverride = 4, + Children = + { + new VBoxContainer + { + MouseFilter = MouseFilterMode.Ignore, + Children = + { + (_textureRect = new TextureRect + { + Texture = texture, + SizeFlagsHorizontal = SizeFlags.ShrinkCenter, + SizeFlagsVertical = SizeFlags.Expand | SizeFlags.ShrinkCenter, + MouseFilter = MouseFilterMode.Ignore, + ModulateSelfOverride = ColorNormal, + CustomMinimumSize = (0, 32), + Stretch = TextureRect.StretchMode.KeepCentered + }), + (_label = new Label + { + Text = keyName, + SizeFlagsHorizontal = SizeFlags.ShrinkCenter, + MouseFilter = MouseFilterMode.Ignore, + ModulateSelfOverride = ColorNormal, + StyleClasses = {StyleClassLabelTopButton} + }) + } + } + } }); - _container.AddChild(_label = new Label - { - Text = keyName, - SizeFlagsHorizontal = SizeFlags.ShrinkCenter, - MouseFilter = MouseFilterMode.Ignore, - ModulateSelfOverride = ColorNormal - }); - - _label.AddStyleClass(StyleClassLabelTopButton); - - _container.SetAnchorAndMarginPreset(LayoutPreset.Wide); - DrawModeChanged(); } protected override Vector2 CalculateMinimumSize() { var styleSize = ActualStyleBox?.MinimumSize ?? Vector2.Zero; - return (0, 4) + styleSize + _container?.CombinedMinimumSize ?? Vector2.Zero; + return (0, 4) + styleSize + base.CalculateMinimumSize(); } protected override void Draw(DrawingHandleScreen handle) @@ -420,21 +427,15 @@ namespace Content.Client.UserInterface } } - protected override void StylePropertiesChanged() + protected override void LayoutUpdateOverride() { - base.StylePropertiesChanged(); - - if (_container == null) - { - return; - } - var box = ActualStyleBox ?? new StyleBoxEmpty(); + var contentBox = box.GetContentBox(PixelSizeBox); - _container.MarginLeft = box.GetContentMargin(StyleBox.Margin.Left); - _container.MarginRight = -box.GetContentMargin(StyleBox.Margin.Right); - _container.MarginTop = box.GetContentMargin(StyleBox.Margin.Top) + 4; - _container.MarginBottom = -box.GetContentMargin(StyleBox.Margin.Bottom); + foreach (var child in Children) + { + FitChildInPixelBox(child, (UIBox2i) contentBox); + } } } } diff --git a/Content.Client/UserInterface/HandsGui.cs b/Content.Client/UserInterface/HandsGui.cs index ea58a334b2..d68d2aed08 100644 --- a/Content.Client/UserInterface/HandsGui.cs +++ b/Content.Client/UserInterface/HandsGui.cs @@ -52,6 +52,9 @@ namespace Content.Client.UserInterface private readonly TextureRect CooldownCircleLeft; private readonly TextureRect CooldownCircleRight; + private readonly Control _leftContainer; + private readonly Control _rightContainer; + public HandsGui() { IoCManager.InjectDependencies(this); @@ -72,30 +75,35 @@ namespace Content.Client.UserInterface _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/cooldown-{i}.png"); } - AddChild(new TextureRect + _leftContainer = new Control {MouseFilter = MouseFilterMode.Ignore}; + _rightContainer = new Control {MouseFilter = MouseFilterMode.Ignore}; + var hBox = new HBoxContainer + { + SeparationOverride = 0, + Children = {_rightContainer, _leftContainer}, + MouseFilter = MouseFilterMode.Ignore + }; + + AddChild(hBox); + + _leftContainer.AddChild(new TextureRect { MouseFilter = MouseFilterMode.Ignore, Texture = TextureHandLeft, - Size = _handL.Size, - Position = _handL.TopLeft, TextureScale = (2, 2) }); - AddChild(new TextureRect + _rightContainer.AddChild(new TextureRect { MouseFilter = MouseFilterMode.Ignore, Texture = TextureHandRight, - Size = _handR.Size, - Position = _handR.TopLeft, TextureScale = (2, 2) }); - AddChild(ActiveHandRect = new TextureRect + _leftContainer.AddChild(ActiveHandRect = new TextureRect { MouseFilter = MouseFilterMode.Ignore, Texture = TextureHandActive, - Size = _handL.Size, - Position = _handL.TopLeft, TextureScale = (2, 2) }); @@ -104,43 +112,31 @@ namespace Content.Client.UserInterface MouseFilter = MouseFilterMode.Ignore, Scale = (2, 2) }; - AddChild(LeftSpriteView); - LeftSpriteView.Size = _handL.Size; - LeftSpriteView.Position = _handL.TopLeft; + _leftContainer.AddChild(LeftSpriteView); RightSpriteView = new SpriteView { MouseFilter = MouseFilterMode.Ignore, Scale = (2, 2) }; - AddChild(RightSpriteView); - RightSpriteView.Size = _handR.Size; - RightSpriteView.Position = _handR.TopLeft; + _rightContainer.AddChild(RightSpriteView); // Cooldown circles. - AddChild(CooldownCircleLeft = new TextureRect + _leftContainer.AddChild(CooldownCircleLeft = new TextureRect { MouseFilter = MouseFilterMode.Ignore, - Position = _handL.TopLeft + (8, 8), TextureScale = (2, 2), Visible = false, - }); - AddChild(CooldownCircleRight = new TextureRect + _rightContainer.AddChild(CooldownCircleRight = new TextureRect { MouseFilter = MouseFilterMode.Ignore, - Position = _handR.TopLeft + (8, 8), TextureScale = (2, 2), Visible = false }); } - protected override Vector2 CalculateMinimumSize() - { - return new Vector2(BoxSize * 2 + BoxSpacing, BoxSize) * UIScale; - } - /// /// Gets the hands component controling this gui, returns true if successful and false if failure /// @@ -169,7 +165,9 @@ namespace Content.Client.UserInterface var left = hands.GetEntity("left"); var right = hands.GetEntity("right"); - ActiveHandRect.Position = hands.ActiveIndex == "left" ? _handL.TopLeft : _handR.TopLeft; + ActiveHandRect.Parent.RemoveChild(ActiveHandRect); + var parent = hands.ActiveIndex == "left" ? _leftContainer : _rightContainer; + parent.AddChild(ActiveHandRect); if (left != null) { @@ -328,7 +326,7 @@ namespace Content.Client.UserInterface var length = (end - start).TotalSeconds; var progress = (_gameTiming.CurTime - start).TotalSeconds; - var ratio = (float)(progress / length); + var ratio = (float) (progress / length); var textureIndex = CalculateCooldownLevel(ratio); if (textureIndex == CooldownLevels) diff --git a/Content.Client/UserInterface/LobbyGui.cs b/Content.Client/UserInterface/LobbyGui.cs index 458e7a291b..72e39a8301 100644 --- a/Content.Client/UserInterface/LobbyGui.cs +++ b/Content.Client/UserInterface/LobbyGui.cs @@ -22,6 +22,16 @@ namespace Content.Client.UserInterface public LobbyGui(ILocalizationManager localization, IResourceCache resourceCache) { + var margin = new MarginContainer + { + MarginBottomOverride = 20, + MarginLeftOverride = 20, + MarginRightOverride = 20, + MarginTopOverride = 20, + }; + + AddChild(margin); + var panelTex = resourceCache.GetTexture("/Nano/button.svg.96dpi.png"); var back = new StyleBoxTexture { @@ -30,53 +40,58 @@ namespace Content.Client.UserInterface }; back.SetPatchMargin(StyleBox.Margin.All, 10); - var panel = new Panel + var panel = new PanelContainer { PanelOverride = back }; - AddChild(panel); - - panel.SetAnchorAndMarginPreset(LayoutPreset.Wide); + margin.AddChild(panel); var vBox = new VBoxContainer {SeparationOverride = 0}; - vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); + margin.AddChild(vBox); - vBox.MarginTop = 40; - - AddChild(vBox); - - AddChild(new Label + var topHBox = new HBoxContainer { - Text = localization.GetString("Lobby"), - StyleClasses = {NanoStyle.StyleClassLabelHeadingBigger}, - MarginBottom = 40, - MarginLeft = 8, - VAlign = Label.VAlignMode.Center - }); + CustomMinimumSize = (0, 40), + Children = + { + new MarginContainer + { + MarginLeftOverride = 8, + Children = + { + new Label + { + Text = localization.GetString("Lobby"), + StyleClasses = {NanoStyle.StyleClassLabelHeadingBigger}, + /*MarginBottom = 40, + MarginLeft = 8,*/ + VAlign = Label.VAlignMode.Center + } + } + }, + (ServerName = new Label + { + StyleClasses = {NanoStyle.StyleClassLabelHeadingBigger}, + /*MarginBottom = 40, + GrowHorizontal = GrowDirection.Both,*/ + VAlign = Label.VAlignMode.Center, + SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter + }), + (LeaveButton = new Button + { + SizeFlagsHorizontal = SizeFlags.ShrinkEnd, + Text = localization.GetString("Leave"), + StyleClasses = {NanoStyle.StyleClassButtonBig}, + //GrowHorizontal = GrowDirection.Begin + }) + } + }; - AddChild(ServerName = new Label - { - StyleClasses = {NanoStyle.StyleClassLabelHeadingBigger}, - MarginBottom = 40, - GrowHorizontal = GrowDirection.Both, - VAlign = Label.VAlignMode.Center - }); + vBox.AddChild(topHBox); - ServerName.SetAnchorAndMarginPreset(LayoutPreset.CenterTop); - - AddChild(LeaveButton = new Button - { - SizeFlagsHorizontal = SizeFlags.ShrinkEnd, - Text = localization.GetString("Leave"), - StyleClasses = {NanoStyle.StyleClassButtonBig}, - GrowHorizontal = GrowDirection.Begin - }); - - LeaveButton.SetAnchorAndMarginPreset(LayoutPreset.TopRight); - - vBox.AddChild(new Panel + vBox.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat { @@ -131,7 +146,7 @@ namespace Content.Client.UserInterface SizeFlagsHorizontal = SizeFlags.FillExpand, Align = Label.AlignMode.Right, FontColorOverride = Color.DarkGray, - StyleClasses = { NanoStyle.StyleClassLabelBig } + StyleClasses = {NanoStyle.StyleClassLabelBig} }), (ReadyButton = new Button { @@ -164,7 +179,7 @@ namespace Content.Client.UserInterface } }); - hBox.AddChild(new Panel + hBox.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat {BackgroundColor = NanoStyle.NanoGold}, CustomMinimumSize = (2, 0) }); diff --git a/Content.Client/UserInterface/NanoHeading.cs b/Content.Client/UserInterface/NanoHeading.cs index 7e149b489d..30dde27fc5 100644 --- a/Content.Client/UserInterface/NanoHeading.cs +++ b/Content.Client/UserInterface/NanoHeading.cs @@ -33,7 +33,7 @@ namespace Content.Client.UserInterface return _panel.CombinedMinimumSize; } - protected override void SortChildren() + protected override void LayoutUpdateOverride() { FitChildInBox(_panel, SizeBox); } diff --git a/Content.Client/UserInterface/NanoStyle.cs b/Content.Client/UserInterface/NanoStyle.cs index 73dfab6a11..32de2818cb 100644 --- a/Content.Client/UserInterface/NanoStyle.cs +++ b/Content.Client/UserInterface/NanoStyle.cs @@ -49,6 +49,7 @@ namespace Content.Client.UserInterface Texture = windowHeaderTex, PatchMarginBottom = 3, ExpandMarginBottom = 3, + ContentMarginBottomOverride = 0 }; var windowBackgroundTex = resCache.GetTexture("/Nano/window_background.png"); var windowBackground = new StyleBoxTexture @@ -223,14 +224,14 @@ namespace Content.Client.UserInterface new SelectorElement(null, new[] {SS14Window.StyleClassWindowPanel}, null, null), new[] { - new StyleProperty(Panel.StylePropertyPanel, windowBackground), + new StyleProperty(PanelContainer.StylePropertyPanel, windowBackground), }), // Window header. new StyleRule( - new SelectorElement(typeof(Panel), new[] {SS14Window.StyleClassWindowHeader}, null, null), + new SelectorElement(typeof(PanelContainer), new[] {SS14Window.StyleClassWindowHeader}, null, null), new[] { - new StyleProperty(Panel.StylePropertyPanel, windowHeader), + new StyleProperty(PanelContainer.StylePropertyPanel, windowHeader), }), // Window close button base texture. new StyleRule( diff --git a/Content.Client/UserInterface/StatusEffectsUI.cs b/Content.Client/UserInterface/StatusEffectsUI.cs index 5df9c190aa..2e09c01a2f 100644 --- a/Content.Client/UserInterface/StatusEffectsUI.cs +++ b/Content.Client/UserInterface/StatusEffectsUI.cs @@ -13,11 +13,13 @@ namespace Content.Client.UserInterface public StatusEffectsUI() { - _vBox = new VBoxContainer {GrowHorizontal = GrowDirection.Begin}; + _vBox = new VBoxContainer(); + MouseFilter = Control.MouseFilterMode.Ignore; AddChild(_vBox); - SetAnchorAndMarginPreset(LayoutPreset.TopRight); - MarginTop = 250; - MarginRight = 10; + + LayoutContainer.SetGrowHorizontal(this, LayoutContainer.GrowDirection.Begin); + LayoutContainer.SetAnchorAndMarginPreset(this, LayoutContainer.LayoutPreset.TopRight, margin: 10); + LayoutContainer.SetMarginTop(this, 250); } } } diff --git a/Content.Client/UserInterface/StripeBack.cs b/Content.Client/UserInterface/StripeBack.cs index ca538f7904..852c71deab 100644 --- a/Content.Client/UserInterface/StripeBack.cs +++ b/Content.Client/UserInterface/StripeBack.cs @@ -57,7 +57,7 @@ namespace Content.Client.UserInterface return size; } - protected override void SortChildren() + protected override void LayoutUpdateOverride() { var box = SizeBox; diff --git a/Content.Client/UserInterface/TutorialWindow.cs b/Content.Client/UserInterface/TutorialWindow.cs index 546fc68b93..233ced7307 100644 --- a/Content.Client/UserInterface/TutorialWindow.cs +++ b/Content.Client/UserInterface/TutorialWindow.cs @@ -1,5 +1,6 @@ using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; +using Robust.Shared.Maths; using Robust.Shared.Utility; namespace Content.Client.UserInterface @@ -25,11 +26,13 @@ If you are not on a QWERTY keyboard, the keys mentioned above are bound to the p For example on AZERTY movement is ZQSD, drop is A, W is activate in hand. Instead of intents, we have ""combat mode"". Hit 1 (on your number row) to toggle it on or off. -You can't attack anybody with it off, so no more hitting yourself with your own crowbar. +You can't attack anybody with it off, so no more hitting yourself with your own crowbar. If you have any feedback, questions, bug reports, etc..., do not be afraid to tell us! You can ask on Discord or heck, just write it in OOC! We'll catch it."; + protected override Vector2? CustomSize => (300, 400); + public TutorialWindow() { Title = "The Tutorial!"; diff --git a/Resources/Nano/cross.svg b/Resources/Nano/cross.svg index 201f0fddf7..0fc6939a83 100644 --- a/Resources/Nano/cross.svg +++ b/Resources/Nano/cross.svg @@ -9,13 +9,13 @@ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="svg8" version="1.1" - viewBox="0 0 53.436268 53.436275" - height="53.436275mm" - width="53.436268mm" + viewBox="0 0 5.8212397 5.8208341" + height="22.000004" + width="22" sodipodi:docname="cross.svg" - inkscape:export-filename="/home/pj/Projects/space-station-14-content/Resources/Nano/cross.svg.png" - inkscape:export-xdpi="15.21" - inkscape:export-ydpi="15.21" + inkscape:export-filename="/home/pj/Projects/space-station-14/Resources/Nano/cross.svg.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96" inkscape:version="0.92.4 5da689c313, 2019-01-14"> + inkscape:window-maximized="1" + inkscape:current-layer="layer1" + units="px" + inkscape:pagecheckerboard="true" /> image/svg+xml - + + ry="3.5718751" + inkscape:label="rect10332" /> diff --git a/Resources/Nano/cross.svg.png b/Resources/Nano/cross.svg.png index ae4dd010d9..db213ed45b 100644 Binary files a/Resources/Nano/cross.svg.png and b/Resources/Nano/cross.svg.png differ diff --git a/RobustToolbox b/RobustToolbox index 9b15070126..6cfe6caae2 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 9b15070126e494515751a467475420f4221e400e +Subproject commit 6cfe6caae27a7e5300efa52688e161c868d5b529 diff --git a/SS14.Launcher/Program.cs b/SS14.Launcher/Program.cs index 92daa67dc1..ca4ed53079 100644 --- a/SS14.Launcher/Program.cs +++ b/SS14.Launcher/Program.cs @@ -406,7 +406,7 @@ namespace SS14.Launcher visitWebsiteButton.OnPressed += _ => _uriOpener.OpenUri("https://spacestation14.io"); - RootControl.SetAnchorPreset(LayoutPreset.Wide); + //RootControl.SetAnchorPreset(LayoutPreset.Wide); } } }