Improved top menu (#2949)
* #272 proper open sides in menu buttons * #272 WIP, good starting point for making the top menu work well at different UI scales * #272 WIP top menu looking better, but inconsistent size * #272 WIP esc nice and big * #272 consistently sized top buttons * #272 proper highlighting of top menu elements * #272 proper highlighting of top menu elements * #272 nice shiny red tutorial button * #272 better tutorial icon * #272 missed svg changes * #272 consistently sized top menu * #272 better padding / alignment of top bar with other UI sections * #272 fix hamburger menu height to match others * #272 top menu name set based on keybind, use shortened names if possible * #272 top menu name set based on keybind, use shortened names if possible * #272 add top menu actions button * #272 add top menu admin button * #272 fix sandbox top button down status * #272 remove todo
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Client.Utility;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
using Robust.Client.UserInterface;
|
||||
@@ -44,7 +45,9 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
public static readonly Color NanoGold = Color.FromHex("#A88B5E");
|
||||
|
||||
public static readonly Color ButtonColorDefault = Color.FromHex("#464966");
|
||||
public static readonly Color ButtonColorDefaultRed = Color.FromHex("#D43B3B");
|
||||
public static readonly Color ButtonColorHovered = Color.FromHex("#575b7f");
|
||||
public static readonly Color ButtonColorHoveredRed = Color.FromHex("#DF6B6B");
|
||||
public static readonly Color ButtonColorPressed = Color.FromHex("#3e6c45");
|
||||
public static readonly Color ButtonColorDisabled = Color.FromHex("#30313c");
|
||||
|
||||
@@ -162,6 +165,33 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
Modulate = ButtonColorPressed
|
||||
};
|
||||
|
||||
var buttonTex = resCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
|
||||
var topButtonBase = new StyleBoxTexture
|
||||
{
|
||||
Texture = buttonTex,
|
||||
};
|
||||
topButtonBase.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
topButtonBase.SetPadding(StyleBox.Margin.All, 0);
|
||||
topButtonBase.SetContentMarginOverride(StyleBox.Margin.All, 0);
|
||||
|
||||
var topButtonOpenRight = new StyleBoxTexture(topButtonBase)
|
||||
{
|
||||
Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((0, 0), (14, 24))),
|
||||
};
|
||||
topButtonOpenRight.SetPatchMargin(StyleBox.Margin.Right, 0);
|
||||
|
||||
var topButtonOpenLeft = new StyleBoxTexture(topButtonBase)
|
||||
{
|
||||
Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (14, 24))),
|
||||
};
|
||||
topButtonOpenLeft.SetPatchMargin(StyleBox.Margin.Left, 0);
|
||||
|
||||
var topButtonSquare = new StyleBoxTexture(topButtonBase)
|
||||
{
|
||||
Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (3, 24))),
|
||||
};
|
||||
topButtonSquare.SetPatchMargin(StyleBox.Margin.Horizontal, 0);
|
||||
|
||||
var textureInvertedTriangle = resCache.GetTexture("/Textures/Interface/Nano/inverted_triangle.svg.png");
|
||||
|
||||
var lineEditTex = resCache.GetTexture("/Textures/Interface/Nano/lineedit.png");
|
||||
@@ -410,6 +440,10 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
.Class(ButtonOpenBoth)
|
||||
.Prop(ContainerButton.StylePropertyStyleBox, BaseButtonOpenBoth),
|
||||
|
||||
Element<ContainerButton>().Class(ContainerButton.StyleClassButton)
|
||||
.Class(ButtonSquare)
|
||||
.Prop(ContainerButton.StylePropertyStyleBox, BaseButtonSquare),
|
||||
|
||||
new StyleRule(new SelectorElement(typeof(Label), new[] { Button.StyleClassButton }, null, null), new[]
|
||||
{
|
||||
new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Center),
|
||||
@@ -808,8 +842,43 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
}),
|
||||
|
||||
// Those top menu buttons.
|
||||
Element<GameHud.TopButton>()
|
||||
.Prop(Button.StylePropertyStyleBox, BaseButton),
|
||||
// these use slight variations on the various BaseButton styles so that the content within them appears centered,
|
||||
// which is NOT the case for the default BaseButton styles (OpenLeft/OpenRight adds extra padding on one of the sides
|
||||
// which makes the TopButton icons appear off-center, which we don't want).
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(GameHud.TopButton), new[] {ButtonSquare}, null, null),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Button.StylePropertyStyleBox, topButtonSquare),
|
||||
}),
|
||||
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(GameHud.TopButton), new[] {ButtonOpenLeft}, null, null),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Button.StylePropertyStyleBox, topButtonOpenLeft),
|
||||
}),
|
||||
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(GameHud.TopButton), new[] {ButtonOpenRight}, null, null),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Button.StylePropertyStyleBox, topButtonOpenRight),
|
||||
}),
|
||||
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(GameHud.TopButton), null, null, new[] {Button.StylePseudoClassNormal}),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorDefault),
|
||||
}),
|
||||
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(GameHud.TopButton), new[] {GameHud.TopButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorDefaultRed),
|
||||
}),
|
||||
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(GameHud.TopButton), null, null, new[] {Button.StylePseudoClassNormal}),
|
||||
@@ -832,6 +901,13 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorHovered),
|
||||
}),
|
||||
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(GameHud.TopButton), new[] {GameHud.TopButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassHover}),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorHoveredRed),
|
||||
}),
|
||||
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(Label), new[] {GameHud.TopButton.StyleClassLabelTopButton}, null, null),
|
||||
new[]
|
||||
|
||||
Reference in New Issue
Block a user