diff --git a/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs b/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs index ae94888011..09abf4636c 100644 --- a/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs +++ b/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs @@ -9,6 +9,7 @@ using Robust.Shared.Utility; using System.Collections.Generic; using System.Linq; using Robust.Client.Interfaces.Graphics; +using Robust.Client.UserInterface.Controls; namespace Content.Client.GameObjects.Components.Actor { @@ -41,9 +42,7 @@ namespace Content.Client.GameObjects.Components.Actor var UIcomponents = Owner.GetAllComponents(); _window = new CharacterWindow(UIcomponents); - //Add to screen the window and hide it _window.AddToScreen(); - _window.Close(); //Toggle window visible/invisible on keypress _openMenuCmdHandler = InputCmdHandler.FromDelegate(session => { @@ -81,17 +80,24 @@ namespace Content.Client.GameObjects.Components.Actor /// public class CharacterWindow : SS14Window { - protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Mobs/CharacterWindow.tscn"); + private readonly VBoxContainer _contentsVBox; - public CharacterWindow(IEnumerable windowcomponents) : base(IoCManager.Resolve()) + public CharacterWindow(IEnumerable windowComponents) : base(IoCManager.Resolve()) { - //TODO: sort window components by priority of window component - foreach(var element in windowcomponents.OrderByDescending(x => x.Priority)) + Title = "Character"; + HideOnClose = true; + Visible = false; + + _contentsVBox = new VBoxContainer(); + Contents.AddChild(_contentsVBox); + + // TODO: sort window components by priority of window component + foreach (var element in windowComponents.OrderBy(x => x.Priority)) { - Contents.AddChild(element.Scene); + _contentsVBox.AddChild(element.Scene); } - HideOnClose = true; + Size = CombinedMinimumSize; } } } diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs index f96eaf12e5..587c836d23 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs @@ -171,16 +171,11 @@ namespace Content.Client.GameObjects /// /// Temporary window to hold the basis for inventory hud /// - private class InventoryWindow : PanelContainer + private class InventoryWindow : GridContainer { - private int elements_x; - - private GridContainer GridContainer; private List IndexedSlots; private Dictionary InventorySlots = new Dictionary(); //ordered dictionary? - private ClientInventoryComponent InventoryComponent; - - protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Mobs/HumanInventory.tscn"); + private readonly ClientInventoryComponent InventoryComponent; public InventoryWindow(ClientInventoryComponent inventory) { @@ -192,15 +187,13 @@ namespace Content.Client.GameObjects /// public void CreateInventory(Inventory inventory) { - elements_x = inventory.Columns; + Columns = inventory.Columns; - GridContainer = (GridContainer)GetChild("CenterContainer").GetChild("GridContainer"); - GridContainer.Columns = elements_x; IndexedSlots = new List(inventory.SlotMasks); - foreach (Slots slot in IndexedSlots) + foreach (var slot in IndexedSlots) { - InventoryButton newbutton = new InventoryButton(slot); + var newButton = new InventoryButton(slot); if (slot == Slots.NONE) { @@ -209,18 +202,18 @@ namespace Content.Client.GameObjects } else { - //Store slot button and give it the default onpress behavior for empty elements - newbutton.GetChild