]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Even spaced hotbar (#22252)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Mon, 11 Dec 2023 11:37:51 +0000 (06:37 -0500)
committerGitHub <noreply@github.com>
Mon, 11 Dec 2023 11:37:51 +0000 (04:37 -0700)
* Fix spacing on hotbar

* more tweaksies

Content.Client/UserInterface/Systems/Hands/Controls/HandsContainer.cs
Content.Client/UserInterface/Systems/Hotbar/Widgets/HotbarGui.xaml
Content.Client/UserInterface/Systems/Inventory/Controls/ItemSlotUIContainer.cs
Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml
Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml
Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml
Resources/Prototypes/InventoryTemplates/human_inventory_template.yml
Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml

index 4f97adeca894825a1ec1c12d9cc698ebbe38be94..1421e302b867346fe03ffe2bd0552f60055a4ee6 100644 (file)
@@ -10,6 +10,8 @@ public sealed class HandsContainer : ItemSlotUIContainer<HandButton>
     public int ColumnLimit { get => _grid.Columns; set => _grid.Columns = value; }
     public int MaxButtonCount { get; set; } = 0;
 
+    public int MaxButtonsPerRow { get; set;  }= 6;
+
     /// <summary>
     ///     Indexer. This is used to reference a HandsContainer from the
     ///     controller.
@@ -36,6 +38,7 @@ public sealed class HandsContainer : ItemSlotUIContainer<HandButton>
             _grid.AddChild(newButton);
         }
 
+        _grid.Columns = Math.Min(_grid.ChildCount, MaxButtonsPerRow);
         return base.AddButton(newButton);
     }
 
index a760de7430ebcd15f148c12a7f278b6593da053e..04b606de0808c1945ce068d4e99aa93aae6c6d88 100644 (file)
                 Visible="False"/>
         </BoxContainer>
     </Control>
-    <inventory:ItemSlotButtonContainer
-        Name="InventoryHotbar"
-        Access="Public"
-        Visible="False"
-        Columns="10"
-        SlotGroup="Default"
-        ExpandBackwards="True"
-        VerticalExpand="True"
-        HorizontalAlignment="Center"
-        VerticalAlignment="Bottom"
-    />
-    <BoxContainer Orientation="Horizontal" Name="Hotbar">
+    <BoxContainer Orientation="Vertical">
         <inventory:ItemSlotButtonContainer
-            Name="SecondHotbar"
-            SlotGroup="SecondHotbar"
-            VerticalAlignment="Bottom"
-            HorizontalAlignment="Right"
-            VerticalExpand="False"
-            Columns="6"
-            HorizontalExpand="True"/>
-        <hands:HandsContainer
-            Name="HandContainer"
+            Name="InventoryHotbar"
             Access="Public"
+            Visible="False"
+            Columns="10"
+            SlotGroup="Default"
+            ExpandBackwards="True"
+            VerticalExpand="True"
             HorizontalAlignment="Center"
-            ColumnLimit="6" />
-        <inventory:ItemSlotButtonContainer
-            Name="MainHotbar"
-            SlotGroup="MainHotbar"
-            VerticalExpand="False"
-            HorizontalAlignment="Left"
             VerticalAlignment="Bottom"
-            HorizontalExpand="True"
-            Columns="6"
-            />
+            Margin="0 0 0 4"
+        />
+        <BoxContainer Orientation="Horizontal" Name="Hotbar" HorizontalAlignment="Center">
+            <inventory:ItemSlotButtonContainer
+                Name="SecondHotbar"
+                SlotGroup="SecondHotbar"
+                VerticalAlignment="Bottom"
+                HorizontalAlignment="Right"
+                VerticalExpand="False"
+                ExpandBackwards="True"
+                Columns="6"
+                HorizontalExpand="False"/>
+            <hands:HandsContainer
+                Name="HandContainer"
+                Access="Public"
+                HorizontalAlignment="Center"
+                HorizontalExpand="False"
+                ColumnLimit="6"
+                Margin="4 0 4 0"/>
+            <inventory:ItemSlotButtonContainer
+                Name="MainHotbar"
+                SlotGroup="MainHotbar"
+                VerticalExpand="False"
+                HorizontalAlignment="Left"
+                VerticalAlignment="Bottom"
+                HorizontalExpand="False"
+                ExpandBackwards="True"
+                Columns="6"
+                />
+        </BoxContainer>
     </BoxContainer>
 </widgets:HotbarGui>
index 6a2e3fa5cbdf72c893231f669313e69d15d8c653..d44a4a2d765f826ca1d73a9def53b24b1b12dd0e 100644 (file)
@@ -68,6 +68,7 @@ public abstract class ItemSlotUIContainer<T> : GridContainer, IItemslotUIContain
     {
         if (!Children.Contains(newButton) && newButton.Parent == null && newButton.SlotName != "")
             AddChild(newButton);
+        Columns = ChildCount;
         return AddButtonToDict(newButton);
     }
 
index b41fc3a0ef7330b7fc0716d8261baa111adbcba0..b2559d6f179677530de1e841c0e6fb76da8a8642 100644 (file)
       uiWindowPos: 1,0
       strippingWindowPos: 1,0
       displayName: Head
-    - name: suitstorage
-      slotTexture: suit_storage
-      slotFlags:   SUITSTORAGE
-      stripTime: 3
-      uiWindowPos: 2,0
-      strippingWindowPos: 2,5
-      dependsOn: outerClothing
-      displayName: Suit Storage
     - name: id
       slotTexture: id
       slotFlags: IDCARD
       uiWindowPos: 0,4
       strippingWindowPos: 0,5
       displayName: Pocket 3
-
     - name: outerClothing
       slotTexture: suit
       slotFlags: OUTERCLOTHING
-      slotGroup: SecondHotbar
       stripTime: 6
       uiWindowPos: 1,2
       strippingWindowPos: 1,2
       dependsOn: jumpsuit
       displayName: Pocket 2
       stripHidden: true
+    - name: suitstorage
+      slotTexture: suit_storage
+      slotFlags:   SUITSTORAGE
+      slotGroup: MainHotbar
+      stripTime: 3
+      uiWindowPos: 2,0
+      strippingWindowPos: 2,5
+      dependsOn: outerClothing
+      displayName: Suit Storage
index e980a14bbbb9e6d833916c2f5b5abcb64324d5e8..227624c690f131b5a72b2bd53fe529cd2d018217 100644 (file)
@@ -18,7 +18,6 @@
     - name: outerClothing
       slotTexture: suit
       slotFlags: OUTERCLOTHING
-      slotGroup: MainHotbar
       stripTime: 6
       uiWindowPos: 1,2
       strippingWindowPos: 1,2
@@ -77,6 +76,7 @@
     - name: suitstorage
       slotTexture: suit_storage
       slotFlags:   SUITSTORAGE
+      slotGroup: MainHotbar
       stripTime: 3
       uiWindowPos: 2,0
       strippingWindowPos: 2,5
index e7ce6ccfa13cf398ea3bdf2f7074e37f3360070a..3fcbd8df6b4daf74683c576b06fc5d3ce0739d9d 100644 (file)
@@ -12,7 +12,6 @@
     - name: outerClothing
       slotTexture: suit
       slotFlags: OUTERCLOTHING
-      slotGroup: MainHotbar
       stripTime: 6
       uiWindowPos: 1,2
       strippingWindowPos: 1,2
@@ -78,6 +77,7 @@
     - name: suitstorage
       slotTexture: suit_storage
       slotFlags:   SUITSTORAGE
+      slotGroup: MainHotbar
       stripTime: 3
       uiWindowPos: 2,0
       strippingWindowPos: 2,5
index 3c7df3cc57c078df93d0f14ee3f95cb2d08f7055..aaf22ac34c56b2fc382b5fe9887c890799b779af 100644 (file)
@@ -18,7 +18,6 @@
     - name: outerClothing
       slotTexture: suit
       slotFlags: OUTERCLOTHING
-      slotGroup: MainHotbar
       stripTime: 6
       uiWindowPos: 1,2
       strippingWindowPos: 1,2
@@ -84,6 +83,7 @@
     - name: suitstorage
       slotTexture: suit_storage
       slotFlags:   SUITSTORAGE
+      slotGroup: MainHotbar
       stripTime: 3
       uiWindowPos: 2,0
       strippingWindowPos: 2,5
index d6b53d0772648719636a4f766e0b6d31bd9d10ce..121648ebabbe4d2d7b72f18a2bb23d253ac828b1 100644 (file)
@@ -4,14 +4,12 @@
   - name: head
     slotTexture: head
     slotFlags: HEAD
-    slotGroup: MainHotbar
     uiWindowPos: 0,0
     strippingWindowPos: 0,0
     displayName: Head
   - name: ears
     slotTexture: ears
     slotFlags: EARS
-    slotGroup: MainHotbar
     stripTime: 3
     uiWindowPos: 1,2
     strippingWindowPos: 1,2
@@ -47,6 +45,7 @@
   - name: suitstorage
     slotTexture: suit_storage
     slotFlags:   SUITSTORAGE
+    slotGroup: MainHotbar
     stripTime: 3
     uiWindowPos: 2,0
     strippingWindowPos: 2,5
@@ -55,7 +54,6 @@
   - name: outerClothing
     slotTexture: suit
     slotFlags: OUTERCLOTHING
-    slotGroup: MainHotbar
     stripTime: 6
     uiWindowPos: 1,3
     strippingWindowPos: 1,3