Improved Inventory / Hand Slots UI (#2965)

This commit is contained in:
chairbender
2021-01-20 00:32:44 -08:00
committed by GitHub
parent 02ea6ce57c
commit f9670d36c4
15 changed files with 304 additions and 152 deletions

View File

@@ -16,6 +16,8 @@ namespace Content.Client.UserInterface.Stylesheets
public sealed class StyleNano : StyleBase
{
public const string StyleClassBorderedWindowPanel = "BorderedWindowPanel";
public const string StyleClassInventorySlotBackground = "InventorySlotBackground";
public const string StyleClassHandSlotHighlight = "HandSlotHighlight";
public const string StyleClassTransparentBorderedWindowPanel = "TransparentBorderedWindowPanel";
public const string StyleClassHotbarPanel = "HotbarPanel";
public const string StyleClassTooltipPanel = "tooltipBox";
@@ -103,6 +105,21 @@ namespace Content.Client.UserInterface.Stylesheets
};
borderedWindowBackground.SetPatchMargin(StyleBox.Margin.All, 2);
var invSlotBgTex = resCache.GetTexture("/Textures/Interface/Inventory/inv_slot_background.png");
var invSlotBg = new StyleBoxTexture
{
Texture = invSlotBgTex,
};
invSlotBg.SetPatchMargin(StyleBox.Margin.All, 2);
invSlotBg.SetContentMarginOverride(StyleBox.Margin.All, 0);
var handSlotHighlightTex = resCache.GetTexture("/Textures/Interface/Inventory/hand_slot_highlight.png");
var handSlotHighlight = new StyleBoxTexture
{
Texture = handSlotHighlightTex,
};
handSlotHighlight.SetPatchMargin(StyleBox.Margin.All, 2);
var borderedTransparentWindowBackgroundTex = resCache.GetTexture("/Textures/Interface/Nano/transparent_window_background_bordered.png");
var borderedTransparentWindowBackground = new StyleBoxTexture
{
@@ -385,6 +402,20 @@ namespace Content.Client.UserInterface.Stylesheets
{
new StyleProperty(PanelContainer.StylePropertyPanel, borderedTransparentWindowBackground),
}),
// inventory slot background
new StyleRule(
new SelectorElement(null, new[] {StyleClassInventorySlotBackground}, null, null),
new[]
{
new StyleProperty(PanelContainer.StylePropertyPanel, invSlotBg),
}),
// hand slot highlight
new StyleRule(
new SelectorElement(null, new[] {StyleClassHandSlotHighlight}, null, null),
new[]
{
new StyleProperty(PanelContainer.StylePropertyPanel, handSlotHighlight),
}),
// Hotbar background
new StyleRule(new SelectorElement(typeof(PanelContainer), new[] {StyleClassHotbarPanel}, null, null),
new[]