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 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);
}

View File

@@ -24,39 +24,46 @@
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>

View 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);
}

View File

@@ -53,14 +53,6 @@
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
@@ -103,11 +95,9 @@
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
@@ -132,3 +122,12 @@
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

View 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

View 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

View 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

View 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