Actions System + UI (#2710)
Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Client.Utility;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
@@ -15,10 +16,19 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
{
|
||||
public const string StyleClassBorderedWindowPanel = "BorderedWindowPanel";
|
||||
public const string StyleClassTransparentBorderedWindowPanel = "TransparentBorderedWindowPanel";
|
||||
public const string StyleClassHotbarPanel = "HotbarPanel";
|
||||
public const string StyleClassTooltipPanel = "tooltipBox";
|
||||
public const string StyleClassTooltipAlertTitle = "tooltipAlertTitle";
|
||||
public const string StyleClassTooltipAlertDescription = "tooltipAlertDesc";
|
||||
public const string StyleClassTooltipAlertCooldown = "tooltipAlertCooldown";
|
||||
public const string StyleClassTooltipActionTitle = "tooltipActionTitle";
|
||||
public const string StyleClassTooltipActionDescription = "tooltipActionDesc";
|
||||
public const string StyleClassTooltipActionCooldown = "tooltipActionCooldown";
|
||||
public const string StyleClassTooltipActionRequirements = "tooltipActionCooldown";
|
||||
public const string StyleClassHotbarSlotNumber = "hotbarSlotNumber";
|
||||
public const string StyleClassActionSearchBox = "actionSearchBox";
|
||||
public const string StyleClassActionMenuItemRevoked = "actionMenuItemRevoked";
|
||||
|
||||
|
||||
public const string StyleClassSliderRed = "Red";
|
||||
public const string StyleClassSliderGreen = "Green";
|
||||
@@ -60,6 +70,8 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
var notoSansItalic12 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Italic.ttf", 12);
|
||||
var notoSansBold12 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 12);
|
||||
var notoSansDisplayBold14 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 14);
|
||||
var notoSansDisplayBold16 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 16);
|
||||
var notoSans15 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 15);
|
||||
var notoSans16 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 16);
|
||||
var notoSansBold16 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 16);
|
||||
var notoSansBold18 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 18);
|
||||
@@ -95,6 +107,61 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
};
|
||||
borderedTransparentWindowBackground.SetPatchMargin(StyleBox.Margin.All, 2);
|
||||
|
||||
var hotbarBackground = new StyleBoxTexture
|
||||
{
|
||||
Texture = borderedWindowBackgroundTex,
|
||||
};
|
||||
hotbarBackground.SetPatchMargin(StyleBox.Margin.All, 2);
|
||||
hotbarBackground.SetExpandMargin(StyleBox.Margin.All, 4);
|
||||
|
||||
var buttonRectTex = resCache.GetTexture("/Textures/Interface/Nano/light_panel_background_bordered.png");
|
||||
var buttonRect = new StyleBoxTexture(BaseButton)
|
||||
{
|
||||
Texture = buttonRectTex
|
||||
};
|
||||
buttonRect.SetPatchMargin(StyleBox.Margin.All, 2);
|
||||
buttonRect.SetPadding(StyleBox.Margin.All, 2);
|
||||
buttonRect.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
|
||||
buttonRect.SetContentMarginOverride(StyleBox.Margin.Horizontal, 2);
|
||||
|
||||
var buttonRectHover = new StyleBoxTexture(buttonRect)
|
||||
{
|
||||
Modulate = ButtonColorHovered
|
||||
};
|
||||
|
||||
var buttonRectPressed = new StyleBoxTexture(buttonRect)
|
||||
{
|
||||
Modulate = ButtonColorPressed
|
||||
};
|
||||
|
||||
var buttonRectDisabled = new StyleBoxTexture(buttonRect)
|
||||
{
|
||||
Modulate = ButtonColorDisabled
|
||||
};
|
||||
|
||||
var buttonRectActionMenuItemTex = resCache.GetTexture("/Textures/Interface/Nano/black_panel_light_thin_border.png");
|
||||
var buttonRectActionMenuRevokedItemTex = resCache.GetTexture("/Textures/Interface/Nano/black_panel_red_thin_border.png");
|
||||
var buttonRectActionMenuItem = new StyleBoxTexture(BaseButton)
|
||||
{
|
||||
Texture = buttonRectActionMenuItemTex
|
||||
};
|
||||
buttonRectActionMenuItem.SetPatchMargin(StyleBox.Margin.All, 2);
|
||||
buttonRectActionMenuItem.SetPadding(StyleBox.Margin.All, 2);
|
||||
buttonRectActionMenuItem.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
|
||||
buttonRectActionMenuItem.SetContentMarginOverride(StyleBox.Margin.Horizontal, 2);
|
||||
var buttonRectActionMenuItemRevoked = new StyleBoxTexture(buttonRectActionMenuItem)
|
||||
{
|
||||
Texture = buttonRectActionMenuRevokedItemTex
|
||||
};
|
||||
var buttonRectActionMenuItemHover = new StyleBoxTexture(buttonRectActionMenuItem)
|
||||
{
|
||||
Modulate = ButtonColorHovered
|
||||
};
|
||||
var buttonRectActionMenuItemPressed = new StyleBoxTexture(buttonRectActionMenuItem)
|
||||
{
|
||||
Modulate = ButtonColorPressed
|
||||
};
|
||||
|
||||
var textureInvertedTriangle = resCache.GetTexture("/Textures/Interface/Nano/inverted_triangle.svg.png");
|
||||
|
||||
var lineEditTex = resCache.GetTexture("/Textures/Interface/Nano/lineedit.png");
|
||||
@@ -105,6 +172,14 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
lineEdit.SetPatchMargin(StyleBox.Margin.All, 3);
|
||||
lineEdit.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5);
|
||||
|
||||
var actionSearchBoxTex = resCache.GetTexture("/Textures/Interface/Nano/black_panel_dark_thin_border.png");
|
||||
var actionSearchBox = new StyleBoxTexture
|
||||
{
|
||||
Texture = actionSearchBoxTex,
|
||||
};
|
||||
actionSearchBox.SetPatchMargin(StyleBox.Margin.All, 3);
|
||||
actionSearchBox.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5);
|
||||
|
||||
var tabContainerPanelTex = resCache.GetTexture("/Textures/Interface/Nano/tabcontainer_panel.png");
|
||||
var tabContainerPanel = new StyleBoxTexture
|
||||
{
|
||||
@@ -280,6 +355,12 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
{
|
||||
new StyleProperty(PanelContainer.StylePropertyPanel, borderedTransparentWindowBackground),
|
||||
}),
|
||||
// Hotbar background
|
||||
new StyleRule(new SelectorElement(typeof(PanelContainer), new[] {StyleClassHotbarPanel}, null, null),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(PanelContainer.StylePropertyPanel, hotbarBackground),
|
||||
}),
|
||||
// Window header.
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(PanelContainer), new[] {SS14Window.StyleClassWindowHeader}, null, null),
|
||||
@@ -376,6 +457,43 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
new StyleProperty("font-color", Color.FromHex("#E5E5E581")),
|
||||
}),
|
||||
|
||||
// action slot hotbar buttons
|
||||
new StyleRule(new SelectorElement(typeof(ActionSlot), null, null, new[] {ContainerButton.StylePseudoClassNormal}), new[]
|
||||
{
|
||||
new StyleProperty(PanelContainer.StylePropertyPanel, buttonRect),
|
||||
}),
|
||||
new StyleRule(new SelectorElement(typeof(ActionSlot), null, null, new[] {ContainerButton.StylePseudoClassHover}), new[]
|
||||
{
|
||||
new StyleProperty(PanelContainer.StylePropertyPanel, buttonRectHover),
|
||||
}),
|
||||
new StyleRule(new SelectorElement(typeof(ActionSlot), null, null, new[] {ContainerButton.StylePseudoClassPressed}), new[]
|
||||
{
|
||||
new StyleProperty(PanelContainer.StylePropertyPanel, buttonRectPressed),
|
||||
}),
|
||||
new StyleRule(new SelectorElement(typeof(ActionSlot), null, null, new[] {ContainerButton.StylePseudoClassDisabled}), new[]
|
||||
{
|
||||
new StyleProperty(PanelContainer.StylePropertyPanel, buttonRectDisabled),
|
||||
}),
|
||||
|
||||
// action menu item buttons
|
||||
new StyleRule(new SelectorElement(typeof(ActionMenuItem), null, null, new[] {ContainerButton.StylePseudoClassNormal}), new[]
|
||||
{
|
||||
new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonRectActionMenuItem),
|
||||
}),
|
||||
// we don't actually disable the action menu items, only change their style based on the underlying action being revoked
|
||||
new StyleRule(new SelectorElement(typeof(ActionMenuItem), new [] {StyleClassActionMenuItemRevoked}, null, new[] {ContainerButton.StylePseudoClassNormal}), new[]
|
||||
{
|
||||
new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonRectActionMenuItemRevoked),
|
||||
}),
|
||||
new StyleRule(new SelectorElement(typeof(ActionMenuItem), null, null, new[] {ContainerButton.StylePseudoClassHover}), new[]
|
||||
{
|
||||
new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonRectActionMenuItemHover),
|
||||
}),
|
||||
new StyleRule(new SelectorElement(typeof(ActionMenuItem), null, null, new[] {ContainerButton.StylePseudoClassPressed}), new[]
|
||||
{
|
||||
new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonRectActionMenuItemPressed),
|
||||
}),
|
||||
|
||||
// Main menu: Make those buttons bigger.
|
||||
new StyleRule(new SelectorChild(
|
||||
new SelectorElement(typeof(Button), null, "mainMenu", null),
|
||||
@@ -413,6 +531,13 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
new StyleProperty("font-color", Color.Gray),
|
||||
}),
|
||||
|
||||
// Action searchbox lineedit
|
||||
new StyleRule(new SelectorElement(typeof(LineEdit), new[] {StyleClassActionSearchBox}, null, null),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(LineEdit.StylePropertyStyleBox, actionSearchBox),
|
||||
}),
|
||||
|
||||
// TabContainer
|
||||
new StyleRule(new SelectorElement(typeof(TabContainer), null, null, null),
|
||||
new[]
|
||||
@@ -531,6 +656,30 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
new StyleProperty("font", notoSans16)
|
||||
}),
|
||||
|
||||
// action tooltip
|
||||
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipActionTitle}, null, null), new[]
|
||||
{
|
||||
new StyleProperty("font", notoSansBold16)
|
||||
}),
|
||||
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipActionDescription}, null, null), new[]
|
||||
{
|
||||
new StyleProperty("font", notoSans15)
|
||||
}),
|
||||
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipActionCooldown}, null, null), new[]
|
||||
{
|
||||
new StyleProperty("font", notoSans15)
|
||||
}),
|
||||
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipActionRequirements}, null, null), new[]
|
||||
{
|
||||
new StyleProperty("font", notoSans15)
|
||||
}),
|
||||
|
||||
// hotbar slot
|
||||
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassHotbarSlotNumber}, null, null), new[]
|
||||
{
|
||||
new StyleProperty("font", notoSansDisplayBold16)
|
||||
}),
|
||||
|
||||
// Entity tooltip
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(PanelContainer), new[] {ExamineSystem.StyleClassEntityTooltip}, null,
|
||||
|
||||
Reference in New Issue
Block a user