Add a style to the popup messages (#867)

This commit is contained in:
Hugal31
2020-05-02 23:20:12 +02:00
committed by GitHub
parent 4534181446
commit 0215092016
2 changed files with 16 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Content.Client.Interfaces; using Content.Client.Interfaces;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared; using Content.Shared;
using Robust.Client.Interfaces.Console; using Robust.Client.Interfaces.Console;
using Robust.Client.Interfaces.Graphics.ClientEye; using Robust.Client.Interfaces.Graphics.ClientEye;
@@ -57,7 +58,11 @@ namespace Content.Client
public void PopupMessage(ScreenCoordinates coordinates, string message) public void PopupMessage(ScreenCoordinates coordinates, string message)
{ {
var label = new PopupLabel {Text = message}; var label = new PopupLabel
{
Text = message,
StyleClasses = { StyleNano.StyleClassPopupMessage },
};
var minimumSize = label.CombinedMinimumSize; var minimumSize = label.CombinedMinimumSize;
LayoutContainer.SetPosition(label, label.InitialPos = coordinates.Position - minimumSize / 2); LayoutContainer.SetPosition(label, label.InitialPos = coordinates.Position - minimumSize / 2);
_userInterfaceManager.PopupRoot.AddChild(label); _userInterfaceManager.PopupRoot.AddChild(label);

View File

@@ -21,6 +21,7 @@ namespace Content.Client.UserInterface.Stylesheets
public const string StyleClassLabelSecondaryColor = "LabelSecondaryColor"; public const string StyleClassLabelSecondaryColor = "LabelSecondaryColor";
public const string StyleClassLabelBig = "LabelBig"; public const string StyleClassLabelBig = "LabelBig";
public const string StyleClassButtonBig = "ButtonBig"; public const string StyleClassButtonBig = "ButtonBig";
public const string StyleClassPopupMessage = "PopupMessage";
public static readonly Color NanoGold = Color.FromHex("#A88B5E"); public static readonly Color NanoGold = Color.FromHex("#A88B5E");
@@ -41,6 +42,7 @@ namespace Content.Client.UserInterface.Stylesheets
public StyleNano(IResourceCache resCache) : base(resCache) public StyleNano(IResourceCache resCache) : base(resCache)
{ {
var notoSans10 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 10); var notoSans10 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 10);
var notoSansItalic10 = resCache.GetFont("/Nano/NotoSans/NotoSans-Italic.ttf", 10);
var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12); var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12);
var notoSansBold12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 12); var notoSansBold12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 12);
var notoSansDisplayBold14 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 14); var notoSansDisplayBold14 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 14);
@@ -552,6 +554,14 @@ namespace Content.Client.UserInterface.Stylesheets
new StyleProperty("font", notoSans16) new StyleProperty("font", notoSans16)
}), }),
// Popup messages
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessage}, null, null),
new[]
{
new StyleProperty("font", notoSansItalic10),
new StyleProperty("font-color", Color.LightGray),
}),
//APC and SMES power state label colors //APC and SMES power state label colors
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPowerStateNone}, null, null), new[] new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPowerStateNone}, null, null), new[]
{ {