diff --git a/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs b/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs index 12f8422aeb2..a921b643ef7 100644 --- a/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs +++ b/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs @@ -18,7 +18,7 @@ public DefaultGameScreen() SetAnchorPreset(ViewportContainer, LayoutPreset.Wide); SetAnchorAndMarginPreset(TopLeft, LayoutPreset.TopLeft, margin: 10); SetAnchorAndMarginPreset(Ghost, LayoutPreset.BottomWide, margin: 80); - SetAnchorAndMarginPreset(Inventory, LayoutPreset.BottomLeft, margin: 5); + SetAnchorAndMarginPreset(Inventory, LayoutPreset.BottomWide, margin: 75); // Emberfall SetAnchorAndMarginPreset(Hotbar, LayoutPreset.BottomWide, margin: 5); SetAnchorAndMarginPreset(Chat, LayoutPreset.TopRight, margin: 10); SetAnchorAndMarginPreset(Alerts, LayoutPreset.TopRight, margin: 10); diff --git a/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs b/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs index 2892ca44254..41383bd345f 100644 --- a/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs +++ b/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs @@ -18,7 +18,7 @@ public SeparatedChatGameScreen() SetAnchorPreset(ScreenContainer, LayoutPreset.Wide); SetAnchorPreset(ViewportContainer, LayoutPreset.Wide); SetAnchorPreset(MainViewport, LayoutPreset.Wide); - SetAnchorAndMarginPreset(Inventory, LayoutPreset.BottomLeft, margin: 5); + SetAnchorAndMarginPreset(Inventory, LayoutPreset.BottomWide, margin: 75); // Emberfall SetAnchorAndMarginPreset(TopLeftContainer, LayoutPreset.TopLeft, margin: 10); SetAnchorAndMarginPreset(Ghost, LayoutPreset.BottomWide, margin: 80); SetAnchorAndMarginPreset(Hotbar, LayoutPreset.BottomWide, margin: 5); diff --git a/Content.Client/UserInterface/Systems/Inventory/InventoryUIController.cs b/Content.Client/UserInterface/Systems/Inventory/InventoryUIController.cs index 49a2fba8981..028971e79bd 100644 --- a/Content.Client/UserInterface/Systems/Inventory/InventoryUIController.cs +++ b/Content.Client/UserInterface/Systems/Inventory/InventoryUIController.cs @@ -43,25 +43,26 @@ public sealed class InventoryUIController : UIController, IOnStateEntered UIManager.GetActiveUIWidgetOrNull()?.InventoryButton; // Emberfall private SlotControl? _lastHovered; - public override void Initialize() - { - base.Initialize(); - - var gameplayStateLoad = UIManager.GetUIController(); - gameplayStateLoad.OnScreenLoad += OnScreenLoad; - } - - private void OnScreenLoad() - { - if (UIManager.ActiveScreen == null) - return; - - if (UIManager.GetActiveUIWidgetOrNull() is { } inventoryGui) - RegisterInventoryButton(inventoryGui.InventoryButton); - } + // public override void Initialize() + // { + // base.Initialize(); + // + // var gameplayStateLoad = UIManager.GetUIController(); + // gameplayStateLoad.OnScreenLoad += OnScreenLoad; + // } + + // private void OnScreenLoad() + // { + // if (UIManager.ActiveScreen == null) + // return; + // + // if (UIManager.GetActiveUIWidgetOrNull() is { } inventoryGui) + // RegisterInventoryButton(inventoryGui.InventoryButton); + // } public void OnStateEntered(GameplayState state) { @@ -75,6 +76,29 @@ public void OnStateEntered(GameplayState state) .Register(); } + // Begin Emberfall changes + public void UnloadButton() + { + if (InventoryButton == null) + return; + + InventoryButton.OnPressed -= ActionButtonPressed; + } + + public void LoadButton() + { + if (InventoryButton == null) + return; + + InventoryButton.OnPressed += ActionButtonPressed; + } + + private void ActionButtonPressed(BaseButton.ButtonEventArgs args) + { + ToggleInventoryBar(); + } + // End Emberfall + public void OnStateExited(GameplayState state) { if (_strippingWindow != null) @@ -171,35 +195,20 @@ private void UpdateInventoryHotbar(InventorySlotsComponent? clientInv) _inventoryHotbar.RemoveChild(child); } - var maxWidth = clothing.Max(p => p.Value.ButtonOffset.X) + 1; - var maxIndex = clothing.Select(p => GetIndex(p.Value.ButtonOffset)).Max(); - - _inventoryHotbar.MaxColumns = maxWidth; - _inventoryHotbar.Columns = maxWidth; - - for (var i = 0; i <= maxIndex; i++) + foreach (var (key, data) in clothing) // Begin Emberfall { - var index = i; - if (clothing.FirstOrNull(p => GetIndex(p.Value.ButtonOffset) == index) is { } pair) - { - if (_inventoryHotbar.TryGetButton(pair.Key, out var slot)) - slot.SetPositionLast(); - } - else + if (!_inventoryHotbar.TryGetButton(key, out var slot)) { - _inventoryHotbar.AddChild(new Control - { - MinSize = new Vector2(64, 64) - }); + slot = CreateSlotButton(data); + _inventoryHotbar.AddButton(slot); } - } - return; - - int GetIndex(Vector2i position) - { - return position.Y * maxWidth + position.X; + var showStorage = _entities.HasComponent(data.HeldEntity); + var update = new SlotSpriteUpdate(data.HeldEntity, data.SlotGroup, data.SlotName, showStorage); + SpriteUpdated(update); } + + _inventoryHotbar.Columns = clothing.Count; // end Emberfall } private void UpdateStrippingWindow(InventorySlotsComponent? clientInv) @@ -251,6 +260,7 @@ public void ToggleInventoryBar() var shouldBeVisible = !_inventoryHotbar.Visible; _inventoryHotbar.Visible = shouldBeVisible; + InventoryButton?.SetClickPressed(shouldBeVisible); // Emberfall } // Neuron Activation diff --git a/Content.Client/UserInterface/Systems/Inventory/Widgets/InventoryGui.xaml b/Content.Client/UserInterface/Systems/Inventory/Widgets/InventoryGui.xaml index d4fb68c38da..ce69f21872c 100644 --- a/Content.Client/UserInterface/Systems/Inventory/Widgets/InventoryGui.xaml +++ b/Content.Client/UserInterface/Systems/Inventory/Widgets/InventoryGui.xaml @@ -1,32 +1,21 @@  - - - - - + xmlns="https://spacestation14.io" + xmlns:inventory="clr-namespace:Content.Client.UserInterface.Systems.Inventory.Controls" + xmlns:widgets="clr-namespace:Content.Client.UserInterface.Systems.Inventory.Widgets" + Name="InventoryInterface" + VerticalExpand="True" + VerticalAlignment="Bottom" + Orientation="Horizontal" + HorizontalAlignment="Center"> + diff --git a/Content.Client/UserInterface/Systems/MenuBar/GameTopMenuBarUIController.cs b/Content.Client/UserInterface/Systems/MenuBar/GameTopMenuBarUIController.cs index e314310bc0c..c8303a99247 100644 --- a/Content.Client/UserInterface/Systems/MenuBar/GameTopMenuBarUIController.cs +++ b/Content.Client/UserInterface/Systems/MenuBar/GameTopMenuBarUIController.cs @@ -7,6 +7,7 @@ using Content.Client.UserInterface.Systems.EscapeMenu; using Content.Client.UserInterface.Systems.Gameplay; using Content.Client.UserInterface.Systems.Guidebook; +using Content.Client.UserInterface.Systems.Inventory; // Emberfall using Content.Client.UserInterface.Systems.MenuBar.Widgets; using Content.Client.UserInterface.Systems.Sandbox; using Robust.Client.UserInterface.Controllers; @@ -24,6 +25,7 @@ public sealed class GameTopMenuBarUIController : UIController [Dependency] private readonly SandboxUIController _sandbox = default!; [Dependency] private readonly GuidebookUIController _guidebook = default!; [Dependency] private readonly EmotesUIController _emotes = default!; + [Dependency] private readonly InventoryUIController _inventory = default!; // Emberfall private GameTopMenuBar? GameTopMenuBar => UIManager.GetActiveUIWidgetOrNull(); @@ -47,6 +49,7 @@ public void UnloadButtons() _action.UnloadButton(); _sandbox.UnloadButton(); _emotes.UnloadButton(); + _inventory.UnloadButton(); // Emberfall } public void LoadButtons() @@ -60,5 +63,6 @@ public void LoadButtons() _action.LoadButton(); _sandbox.LoadButton(); _emotes.LoadButton(); + _inventory.LoadButton(); // Emberfall } } diff --git a/Content.Client/UserInterface/Systems/MenuBar/Widgets/GameTopMenuBar.xaml b/Content.Client/UserInterface/Systems/MenuBar/Widgets/GameTopMenuBar.xaml index dc8972970ac..6e38eac0efc 100644 --- a/Content.Client/UserInterface/Systems/MenuBar/Widgets/GameTopMenuBar.xaml +++ b/Content.Client/UserInterface/Systems/MenuBar/Widgets/GameTopMenuBar.xaml @@ -43,6 +43,16 @@ HorizontalExpand="True" AppendStyleClass="{x:Static style:StyleBase.ButtonSquare}" /> + +