Even spaced hotbar (#22252)

* Fix spacing on hotbar

* more tweaksies
This commit is contained in:
Nemanja
2023-12-11 06:37:51 -05:00
committed by GitHub
parent cf3a5fe747
commit b37b988ce3
8 changed files with 54 additions and 46 deletions

View File

@@ -10,6 +10,8 @@ public sealed class HandsContainer : ItemSlotUIContainer<HandButton>
public int ColumnLimit { get => _grid.Columns; set => _grid.Columns = value; } public int ColumnLimit { get => _grid.Columns; set => _grid.Columns = value; }
public int MaxButtonCount { get; set; } = 0; public int MaxButtonCount { get; set; } = 0;
public int MaxButtonsPerRow { get; set; }= 6;
/// <summary> /// <summary>
/// Indexer. This is used to reference a HandsContainer from the /// Indexer. This is used to reference a HandsContainer from the
/// controller. /// controller.
@@ -36,6 +38,7 @@ public sealed class HandsContainer : ItemSlotUIContainer<HandButton>
_grid.AddChild(newButton); _grid.AddChild(newButton);
} }
_grid.Columns = Math.Min(_grid.ChildCount, MaxButtonsPerRow);
return base.AddButton(newButton); return base.AddButton(newButton);
} }

View File

@@ -24,39 +24,46 @@
Visible="False"/> Visible="False"/>
</BoxContainer> </BoxContainer>
</Control> </Control>
<inventory:ItemSlotButtonContainer <BoxContainer Orientation="Vertical">
Name="InventoryHotbar"
Access="Public"
Visible="False"
Columns="10"
SlotGroup="Default"
ExpandBackwards="True"
VerticalExpand="True"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
/>
<BoxContainer Orientation="Horizontal" Name="Hotbar">
<inventory:ItemSlotButtonContainer <inventory:ItemSlotButtonContainer
Name="SecondHotbar" Name="InventoryHotbar"
SlotGroup="SecondHotbar"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
VerticalExpand="False"
Columns="6"
HorizontalExpand="True"/>
<hands:HandsContainer
Name="HandContainer"
Access="Public" Access="Public"
Visible="False"
Columns="10"
SlotGroup="Default"
ExpandBackwards="True"
VerticalExpand="True"
HorizontalAlignment="Center" HorizontalAlignment="Center"
ColumnLimit="6" />
<inventory:ItemSlotButtonContainer
Name="MainHotbar"
SlotGroup="MainHotbar"
VerticalExpand="False"
HorizontalAlignment="Left"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
HorizontalExpand="True" Margin="0 0 0 4"
Columns="6" />
/> <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> </BoxContainer>
</widgets:HotbarGui> </widgets:HotbarGui>

View File

@@ -68,6 +68,7 @@ public abstract class ItemSlotUIContainer<T> : GridContainer, IItemslotUIContain
{ {
if (!Children.Contains(newButton) && newButton.Parent == null && newButton.SlotName != "") if (!Children.Contains(newButton) && newButton.Parent == null && newButton.SlotName != "")
AddChild(newButton); AddChild(newButton);
Columns = ChildCount;
return AddButtonToDict(newButton); return AddButtonToDict(newButton);
} }

View File

@@ -53,14 +53,6 @@
uiWindowPos: 1,0 uiWindowPos: 1,0
strippingWindowPos: 1,0 strippingWindowPos: 1,0
displayName: Head displayName: Head
- name: suitstorage
slotTexture: suit_storage
slotFlags: SUITSTORAGE
stripTime: 3
uiWindowPos: 2,0
strippingWindowPos: 2,5
dependsOn: outerClothing
displayName: Suit Storage
- name: id - name: id
slotTexture: id slotTexture: id
slotFlags: IDCARD slotFlags: IDCARD
@@ -103,11 +95,9 @@
uiWindowPos: 0,4 uiWindowPos: 0,4
strippingWindowPos: 0,5 strippingWindowPos: 0,5
displayName: Pocket 3 displayName: Pocket 3
- name: outerClothing - name: outerClothing
slotTexture: suit slotTexture: suit
slotFlags: OUTERCLOTHING slotFlags: OUTERCLOTHING
slotGroup: SecondHotbar
stripTime: 6 stripTime: 6
uiWindowPos: 1,2 uiWindowPos: 1,2
strippingWindowPos: 1,2 strippingWindowPos: 1,2
@@ -132,3 +122,12 @@
dependsOn: jumpsuit dependsOn: jumpsuit
displayName: Pocket 2 displayName: Pocket 2
stripHidden: true stripHidden: true
- name: suitstorage
slotTexture: suit_storage
slotFlags: SUITSTORAGE
slotGroup: MainHotbar
stripTime: 3
uiWindowPos: 2,0
strippingWindowPos: 2,5
dependsOn: outerClothing
displayName: Suit Storage

View File

@@ -18,7 +18,6 @@
- name: outerClothing - name: outerClothing
slotTexture: suit slotTexture: suit
slotFlags: OUTERCLOTHING slotFlags: OUTERCLOTHING
slotGroup: MainHotbar
stripTime: 6 stripTime: 6
uiWindowPos: 1,2 uiWindowPos: 1,2
strippingWindowPos: 1,2 strippingWindowPos: 1,2
@@ -77,6 +76,7 @@
- name: suitstorage - name: suitstorage
slotTexture: suit_storage slotTexture: suit_storage
slotFlags: SUITSTORAGE slotFlags: SUITSTORAGE
slotGroup: MainHotbar
stripTime: 3 stripTime: 3
uiWindowPos: 2,0 uiWindowPos: 2,0
strippingWindowPos: 2,5 strippingWindowPos: 2,5

View File

@@ -12,7 +12,6 @@
- name: outerClothing - name: outerClothing
slotTexture: suit slotTexture: suit
slotFlags: OUTERCLOTHING slotFlags: OUTERCLOTHING
slotGroup: MainHotbar
stripTime: 6 stripTime: 6
uiWindowPos: 1,2 uiWindowPos: 1,2
strippingWindowPos: 1,2 strippingWindowPos: 1,2
@@ -78,6 +77,7 @@
- name: suitstorage - name: suitstorage
slotTexture: suit_storage slotTexture: suit_storage
slotFlags: SUITSTORAGE slotFlags: SUITSTORAGE
slotGroup: MainHotbar
stripTime: 3 stripTime: 3
uiWindowPos: 2,0 uiWindowPos: 2,0
strippingWindowPos: 2,5 strippingWindowPos: 2,5

View File

@@ -18,7 +18,6 @@
- name: outerClothing - name: outerClothing
slotTexture: suit slotTexture: suit
slotFlags: OUTERCLOTHING slotFlags: OUTERCLOTHING
slotGroup: MainHotbar
stripTime: 6 stripTime: 6
uiWindowPos: 1,2 uiWindowPos: 1,2
strippingWindowPos: 1,2 strippingWindowPos: 1,2
@@ -84,6 +83,7 @@
- name: suitstorage - name: suitstorage
slotTexture: suit_storage slotTexture: suit_storage
slotFlags: SUITSTORAGE slotFlags: SUITSTORAGE
slotGroup: MainHotbar
stripTime: 3 stripTime: 3
uiWindowPos: 2,0 uiWindowPos: 2,0
strippingWindowPos: 2,5 strippingWindowPos: 2,5

View File

@@ -4,14 +4,12 @@
- name: head - name: head
slotTexture: head slotTexture: head
slotFlags: HEAD slotFlags: HEAD
slotGroup: MainHotbar
uiWindowPos: 0,0 uiWindowPos: 0,0
strippingWindowPos: 0,0 strippingWindowPos: 0,0
displayName: Head displayName: Head
- name: ears - name: ears
slotTexture: ears slotTexture: ears
slotFlags: EARS slotFlags: EARS
slotGroup: MainHotbar
stripTime: 3 stripTime: 3
uiWindowPos: 1,2 uiWindowPos: 1,2
strippingWindowPos: 1,2 strippingWindowPos: 1,2
@@ -47,6 +45,7 @@
- name: suitstorage - name: suitstorage
slotTexture: suit_storage slotTexture: suit_storage
slotFlags: SUITSTORAGE slotFlags: SUITSTORAGE
slotGroup: MainHotbar
stripTime: 3 stripTime: 3
uiWindowPos: 2,0 uiWindowPos: 2,0
strippingWindowPos: 2,5 strippingWindowPos: 2,5
@@ -55,7 +54,6 @@
- name: outerClothing - name: outerClothing
slotTexture: suit slotTexture: suit
slotFlags: OUTERCLOTHING slotFlags: OUTERCLOTHING
slotGroup: MainHotbar
stripTime: 6 stripTime: 6
uiWindowPos: 1,3 uiWindowPos: 1,3
strippingWindowPos: 1,3 strippingWindowPos: 1,3