Voting (#3185)
* Basic voting * Rewrite lobby in XAML. Working lobby voting. * Escape menu is now XAML. * Vote menu works, custom votes, gamemode votes. * Vote timeouts & administration. Basically done now. * I will now pretend I was never planning to code voting hotkeys. * Make vote call UI a bit... funny. * Fix exception on round restart. * Fix some vote command definitions.
This commit is contained in:
committed by
GitHub
parent
db290fd91e
commit
cea87d6985
@@ -2,6 +2,8 @@ using Content.Client.Utility;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.UserInterface.Stylesheets
|
||||
@@ -9,10 +11,13 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
public abstract class StyleBase
|
||||
{
|
||||
public const string ClassHighDivider = "HighDivider";
|
||||
public const string ClassLowDivider = "LowDivider";
|
||||
public const string StyleClassLabelHeading = "LabelHeading";
|
||||
public const string StyleClassLabelSubText = "LabelSubText";
|
||||
public const string StyleClassItalic = "Italic";
|
||||
|
||||
public const string ClassAngleRect = "AngleRect";
|
||||
|
||||
public const string ButtonOpenRight = "OpenRight";
|
||||
public const string ButtonOpenLeft = "OpenLeft";
|
||||
public const string ButtonOpenBoth = "OpenBoth";
|
||||
@@ -30,10 +35,13 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
protected StyleBoxTexture BaseButtonOpenBoth { get; }
|
||||
protected StyleBoxTexture BaseButtonSquare { get; }
|
||||
|
||||
protected StyleBoxTexture BaseAngleRect { get; }
|
||||
|
||||
protected StyleBase(IResourceCache resCache)
|
||||
{
|
||||
var notoSans12 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
|
||||
var notoSans12Italic = resCache.GetFont("/Fonts/NotoSans/NotoSans-Italic.ttf", 12);
|
||||
var textureCloseButton = resCache.GetTexture("/Textures/Interface/Nano/cross.svg.png");
|
||||
|
||||
// Button styles.
|
||||
var buttonTex = resCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
|
||||
@@ -80,6 +88,12 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
BaseButtonSquare.SetPadding(StyleBox.Margin.Right, 2);
|
||||
BaseButtonSquare.SetPadding(StyleBox.Margin.Left, 1);
|
||||
|
||||
BaseAngleRect = new StyleBoxTexture
|
||||
{
|
||||
Texture = buttonTex,
|
||||
};
|
||||
BaseAngleRect.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
|
||||
BaseRules = new[]
|
||||
{
|
||||
// Default font.
|
||||
@@ -97,6 +111,33 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
{
|
||||
new StyleProperty("font", notoSans12Italic),
|
||||
}),
|
||||
|
||||
// Window close button base texture.
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(TextureButton), new[] {SS14Window.StyleClassWindowCloseButton}, null,
|
||||
null),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(TextureButton.StylePropertyTexture, textureCloseButton),
|
||||
new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#4B596A")),
|
||||
}),
|
||||
// Window close button hover.
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(TextureButton), new[] {SS14Window.StyleClassWindowCloseButton}, null,
|
||||
new[] {TextureButton.StylePseudoClassHover}),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#7F3636")),
|
||||
}),
|
||||
// Window close button pressed.
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(TextureButton), new[] {SS14Window.StyleClassWindowCloseButton}, null,
|
||||
new[] {TextureButton.StylePseudoClassPressed}),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#753131")),
|
||||
}),
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,6 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
var notoSansBold16 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 16);
|
||||
var notoSansBold18 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 18);
|
||||
var notoSansBold20 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 20);
|
||||
var textureCloseButton = resCache.GetTexture("/Textures/Interface/Nano/cross.svg.png");
|
||||
var windowHeaderTex = resCache.GetTexture("/Textures/Interface/Nano/window_header.png");
|
||||
var windowHeader = new StyleBoxTexture
|
||||
{
|
||||
@@ -428,31 +427,6 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
{
|
||||
new StyleProperty(PanelContainer.StylePropertyPanel, windowHeader),
|
||||
}),
|
||||
// Window close button base texture.
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(TextureButton), new[] {SS14Window.StyleClassWindowCloseButton}, null,
|
||||
null),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(TextureButton.StylePropertyTexture, textureCloseButton),
|
||||
new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#4B596A")),
|
||||
}),
|
||||
// Window close button hover.
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(TextureButton), new[] {SS14Window.StyleClassWindowCloseButton}, null,
|
||||
new[] {TextureButton.StylePseudoClassHover}),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#7F3636")),
|
||||
}),
|
||||
// Window close button pressed.
|
||||
new StyleRule(
|
||||
new SelectorElement(typeof(TextureButton), new[] {SS14Window.StyleClassWindowCloseButton}, null,
|
||||
new[] {TextureButton.StylePseudoClassPressed}),
|
||||
new[]
|
||||
{
|
||||
new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#753131")),
|
||||
}),
|
||||
|
||||
// Shapes for the buttons.
|
||||
Element<ContainerButton>().Class(ContainerButton.StyleClassButton)
|
||||
@@ -1061,7 +1035,12 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
new StyleRule(new SelectorElement(typeof(PanelContainer), new []{ ClassHighDivider}, null, null), new []
|
||||
{
|
||||
new StyleProperty(PanelContainer.StylePropertyPanel, new StyleBoxFlat { BackgroundColor = NanoGold, ContentMarginBottomOverride = 2, ContentMarginLeftOverride = 2}),
|
||||
})
|
||||
}),
|
||||
|
||||
Element<PanelContainer>().Class(ClassAngleRect)
|
||||
.Prop(PanelContainer.StylePropertyPanel, BaseAngleRect)
|
||||
.Prop(Control.StylePropertyModulateSelf, Color.FromHex("#25252A")),
|
||||
|
||||
}).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,20 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
var notoSans10 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 10);
|
||||
var notoSansBold16 = resCache.GetFont("/Fonts/NotoSans/NotoSans-Bold.ttf", 16);
|
||||
|
||||
var progressBarBackground = new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = new Color(0.25f, 0.25f, 0.25f)
|
||||
};
|
||||
progressBarBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5);
|
||||
|
||||
var progressBarForeground = new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = new Color(0.25f, 0.50f, 0.25f)
|
||||
};
|
||||
progressBarForeground.SetContentMarginOverride(StyleBox.Margin.Vertical, 5);
|
||||
|
||||
var textureInvertedTriangle = resCache.GetTexture("/Textures/Interface/Nano/inverted_triangle.svg.png");
|
||||
|
||||
Stylesheet = new Stylesheet(BaseRules.Concat(new StyleRule[]
|
||||
{
|
||||
Element<Label>().Class(StyleClassLabelHeading)
|
||||
@@ -45,6 +59,15 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
{
|
||||
BackgroundColor = SpaceRed, ContentMarginBottomOverride = 2, ContentMarginLeftOverride = 2
|
||||
}),
|
||||
|
||||
Element<PanelContainer>().Class(ClassLowDivider)
|
||||
.Prop(PanelContainer.StylePropertyPanel, new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = Color.FromHex("#444"),
|
||||
ContentMarginLeftOverride = 2,
|
||||
ContentMarginBottomOverride = 2
|
||||
}),
|
||||
|
||||
// Shapes for the buttons.
|
||||
Element<ContainerButton>().Class(ContainerButton.StyleClassButton)
|
||||
.Prop(ContainerButton.StylePropertyStyleBox, BaseButton),
|
||||
@@ -103,11 +126,42 @@ namespace Content.Client.UserInterface.Stylesheets
|
||||
Element<Label>().Class(ContainerButton.StyleClassButton)
|
||||
.Prop(Label.StylePropertyAlignMode, Label.AlignMode.Center),
|
||||
|
||||
Element<PanelContainer>().Class(ClassAngleRect)
|
||||
.Prop(PanelContainer.StylePropertyPanel, BaseAngleRect)
|
||||
.Prop(Control.StylePropertyModulateSelf, Color.FromHex("#202030")),
|
||||
|
||||
Child()
|
||||
.Parent(Element<Button>().Class(ContainerButton.StylePseudoClassDisabled))
|
||||
.Child(Element<Label>())
|
||||
.Prop("font-color", Color.FromHex("#E5E5E581")),
|
||||
|
||||
Element<ProgressBar>()
|
||||
.Prop(ProgressBar.StylePropertyBackground, progressBarBackground)
|
||||
.Prop(ProgressBar.StylePropertyForeground, progressBarForeground),
|
||||
|
||||
// OptionButton
|
||||
Element<OptionButton>()
|
||||
.Prop(ContainerButton.StylePropertyStyleBox, BaseButton),
|
||||
|
||||
Element<OptionButton>().Pseudo(ContainerButton.StylePseudoClassNormal)
|
||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorDefault),
|
||||
|
||||
Element<OptionButton>().Pseudo(ContainerButton.StylePseudoClassHover)
|
||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorHovered),
|
||||
|
||||
Element<OptionButton>().Pseudo(ContainerButton.StylePseudoClassPressed)
|
||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorPressed),
|
||||
|
||||
Element<OptionButton>().Pseudo(ContainerButton.StylePseudoClassDisabled)
|
||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorDisabled),
|
||||
|
||||
Element<TextureRect>().Class(OptionButton.StyleClassOptionTriangle)
|
||||
.Prop(TextureRect.StylePropertyTexture, textureInvertedTriangle),
|
||||
|
||||
Element<Label>().Class(OptionButton.StyleClassOptionButton)
|
||||
.Prop(Label.StylePropertyAlignMode, Label.AlignMode.Center),
|
||||
|
||||
|
||||
}).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user