APC gui colored external power state (#244)
* Adds colored external power state to APC gui * Move power state colors to StyleSheet
This commit is contained in:
committed by
Pieter-Jan Briers
parent
56bccdbc3e
commit
e07c3c368f
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Shared.GameObjects.Components.Power;
|
||||
using NJsonSchema.Validation;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
@@ -55,12 +56,15 @@ namespace Content.Client.GameObjects.Components.Power
|
||||
{
|
||||
case ApcExternalPowerState.None:
|
||||
_externalPowerStateLabel.Text = "None";
|
||||
_externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateNone);
|
||||
break;
|
||||
case ApcExternalPowerState.Low:
|
||||
_externalPowerStateLabel.Text = "Low";
|
||||
_externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateLow);
|
||||
break;
|
||||
case ApcExternalPowerState.Good:
|
||||
_externalPowerStateLabel.Text = "Good";
|
||||
_externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
@@ -145,6 +149,7 @@ namespace Content.Client.GameObjects.Components.Power
|
||||
var externalStatus = new HBoxContainer("ExternalStatus");
|
||||
var externalStatusLabel = new Label("Label") { Text = "External Power: " };
|
||||
ExternalPowerStateLabel = new Label("Status") { Text = "Good" };
|
||||
ExternalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood);
|
||||
externalStatus.AddChild(externalStatusLabel);
|
||||
externalStatus.AddChild(ExternalPowerStateLabel);
|
||||
rows.AddChild(externalStatus);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Client.Utility;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
@@ -16,6 +16,11 @@ namespace Content.Client.UserInterface
|
||||
public const string StyleClassButtonBig = "ButtonBig";
|
||||
private static readonly Color NanoGold = Color.FromHex("#A88B5E");
|
||||
|
||||
//Used by the APC and SMES menus
|
||||
public const string StyleClassPowerStateNone = "PowerStateNone";
|
||||
public const string StyleClassPowerStateLow = "PowerStateLow";
|
||||
public const string StyleClassPowerStateGood = "PowerStateGood";
|
||||
|
||||
public Stylesheet Stylesheet { get; }
|
||||
|
||||
public NanoStyle()
|
||||
@@ -420,6 +425,22 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
new StyleProperty("font", notoSans16)
|
||||
}),
|
||||
|
||||
//APC and SMES power state label colors
|
||||
new StyleRule(new SelectorElement(typeof(Label), new []{StyleClassPowerStateNone}, null, null), new []
|
||||
{
|
||||
new StyleProperty(Label.StylePropertyFontColor, new Color(0.8f, 0.0f, 0.0f))
|
||||
}),
|
||||
|
||||
new StyleRule(new SelectorElement(typeof(Label), new []{StyleClassPowerStateLow}, null, null), new []
|
||||
{
|
||||
new StyleProperty(Label.StylePropertyFontColor, new Color(0.9f, 0.36f, 0.0f))
|
||||
}),
|
||||
|
||||
new StyleRule(new SelectorElement(typeof(Label), new []{StyleClassPowerStateGood}, null, null), new []
|
||||
{
|
||||
new StyleProperty(Label.StylePropertyFontColor, new Color(0.024f, 0.8f, 0.0f))
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user