Corner Clothing UI (#22883)

* Corner clothing (save point)

* IT WORKS. YIPPEE

* the last of it

* template rejigs
This commit is contained in:
Nemanja
2023-12-23 01:32:23 -05:00
committed by GitHub
parent 33399db6c2
commit 9b18357a88
32 changed files with 240 additions and 146 deletions

View File

@@ -4,6 +4,7 @@ using Content.Client.UserInterface.Systems.Hands.Controls;
using Content.Client.UserInterface.Systems.Hotbar.Widgets;
using Content.Client.UserInterface.Systems.Inventory;
using Content.Client.UserInterface.Systems.Inventory.Controls;
using Content.Client.UserInterface.Systems.Inventory.Widgets;
using Content.Client.UserInterface.Systems.Storage;
using Content.Client.UserInterface.Systems.Storage.Controls;
using Robust.Client.UserInterface;
@@ -30,13 +31,12 @@ public sealed class HotbarUIController : UIController
ReloadHotbar();
}
public void Setup(HandsContainer handsContainer, ItemSlotButtonContainer inventoryBar, ItemStatusPanel handStatus, StorageContainer storageContainer)
public void Setup(HandsContainer handsContainer, ItemStatusPanel handStatus, StorageContainer storageContainer)
{
_inventory = UIManager.GetUIController<InventoryUIController>();
_hands = UIManager.GetUIController<HandsUIController>();
_storage = UIManager.GetUIController<StorageUIController>();
_hands.RegisterHandContainer(handsContainer);
_inventory.RegisterInventoryBarContainer(inventoryBar);
_storage.RegisterStorageContainer(storageContainer);
}
@@ -47,25 +47,35 @@ public sealed class HotbarUIController : UIController
return;
}
var hotbar = UIManager.ActiveScreen.GetWidget<HotbarGui>();
if (UIManager.ActiveScreen.GetWidget<HotbarGui>() is { } hotbar)
{
foreach (var container in GetAllItemSlotContainers(hotbar))
{
// Yes, this is dirty.
container.SlotGroup = container.SlotGroup;
}
}
if (hotbar == null)
_hands?.ReloadHands();
_inventory?.ReloadSlots();
//todo move this over to its own hellhole
var inventory = UIManager.ActiveScreen.GetWidget<InventoryGui>();
if (inventory == null)
{
return;
}
foreach (var container in GetAllItemSlotContainers(hotbar))
foreach (var container in GetAllItemSlotContainers(inventory))
{
// Yes, this is dirty.
container.SlotGroup = container.SlotGroup;
}
_hands?.ReloadHands();
_inventory?.ReloadSlots();
_inventory?.RegisterInventoryBarContainer(hotbar.InventoryHotbar);
_inventory?.RegisterInventoryBarContainer(inventory.InventoryHotbar);
}
private IEnumerable<ItemSlotButtonContainer> GetAllItemSlotContainers(Control gui)
private static IEnumerable<ItemSlotButtonContainer> GetAllItemSlotContainers(Control gui)
{
var result = new List<ItemSlotButtonContainer>();

View File

@@ -5,38 +5,26 @@
xmlns:hands="clr-namespace:Content.Client.UserInterface.Systems.Hands.Controls"
xmlns:widgets="clr-namespace:Content.Client.UserInterface.Systems.Hotbar.Widgets"
Name="HotbarInterface"
VerticalExpand="False"
VerticalExpand="True"
VerticalAlignment="Bottom"
Orientation="Vertical"
HorizontalAlignment="Center">
<Control HorizontalAlignment="Center">
<inventory:ItemStatusPanel
Name="StatusPanel"
Visible="False"
HorizontalAlignment="Center"
/>
<BoxContainer Name="StorageContainer"
Access="Public"
HorizontalAlignment="Center"
Margin="10">
<storage:StorageContainer
Name="StoragePanel"
Visible="False"/>
</BoxContainer>
</Control>
<BoxContainer Orientation="Vertical">
<inventory:ItemSlotButtonContainer
Name="InventoryHotbar"
Access="Public"
Visible="False"
Columns="10"
SlotGroup="Default"
ExpandBackwards="True"
VerticalExpand="True"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Margin="0 0 0 4"
/>
<Control HorizontalAlignment="Center">
<inventory:ItemStatusPanel
Name="StatusPanel"
Visible="False"
HorizontalAlignment="Center"
/>
<BoxContainer Name="StorageContainer"
Access="Public"
HorizontalAlignment="Center"
Margin="10">
<storage:StorageContainer
Name="StoragePanel"
Visible="False"/>
</BoxContainer>
</Control>
<BoxContainer Orientation="Horizontal" Name="Hotbar" HorizontalAlignment="Center">
<inventory:ItemSlotButtonContainer
Name="SecondHotbar"

View File

@@ -13,7 +13,7 @@ public sealed partial class HotbarGui : UIWidget
StatusPanel.Update(null);
var hotbarController = UserInterfaceManager.GetUIController<HotbarUIController>();
hotbarController.Setup(HandContainer, InventoryHotbar, StatusPanel, StoragePanel);
hotbarController.Setup(HandContainer, StatusPanel, StoragePanel);
LayoutContainer.SetGrowVertical(this, LayoutContainer.GrowDirection.Begin);
}