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 System;
|
||||||
|
using Content.Client.UserInterface;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using NJsonSchema.Validation;
|
using NJsonSchema.Validation;
|
||||||
using OpenTK.Graphics.OpenGL4;
|
using OpenTK.Graphics.OpenGL4;
|
||||||
@@ -55,12 +56,15 @@ namespace Content.Client.GameObjects.Components.Power
|
|||||||
{
|
{
|
||||||
case ApcExternalPowerState.None:
|
case ApcExternalPowerState.None:
|
||||||
_externalPowerStateLabel.Text = "None";
|
_externalPowerStateLabel.Text = "None";
|
||||||
|
_externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateNone);
|
||||||
break;
|
break;
|
||||||
case ApcExternalPowerState.Low:
|
case ApcExternalPowerState.Low:
|
||||||
_externalPowerStateLabel.Text = "Low";
|
_externalPowerStateLabel.Text = "Low";
|
||||||
|
_externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateLow);
|
||||||
break;
|
break;
|
||||||
case ApcExternalPowerState.Good:
|
case ApcExternalPowerState.Good:
|
||||||
_externalPowerStateLabel.Text = "Good";
|
_externalPowerStateLabel.Text = "Good";
|
||||||
|
_externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
@@ -145,10 +149,11 @@ namespace Content.Client.GameObjects.Components.Power
|
|||||||
var externalStatus = new HBoxContainer("ExternalStatus");
|
var externalStatus = new HBoxContainer("ExternalStatus");
|
||||||
var externalStatusLabel = new Label("Label") { Text = "External Power: " };
|
var externalStatusLabel = new Label("Label") { Text = "External Power: " };
|
||||||
ExternalPowerStateLabel = new Label("Status") { Text = "Good" };
|
ExternalPowerStateLabel = new Label("Status") { Text = "Good" };
|
||||||
|
ExternalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood);
|
||||||
externalStatus.AddChild(externalStatusLabel);
|
externalStatus.AddChild(externalStatusLabel);
|
||||||
externalStatus.AddChild(ExternalPowerStateLabel);
|
externalStatus.AddChild(ExternalPowerStateLabel);
|
||||||
rows.AddChild(externalStatus);
|
rows.AddChild(externalStatus);
|
||||||
|
|
||||||
var charge = new HBoxContainer("Charge");
|
var charge = new HBoxContainer("Charge");
|
||||||
var chargeLabel = new Label("Label") { Text = "Charge:" };
|
var chargeLabel = new Label("Label") { Text = "Charge:" };
|
||||||
ChargeBar = new ProgressBar("Charge")
|
ChargeBar = new ProgressBar("Charge")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Client.GameObjects.EntitySystems;
|
using Content.Client.GameObjects.EntitySystems;
|
||||||
using Content.Client.Utility;
|
using Content.Client.Utility;
|
||||||
using Robust.Client.Graphics.Drawing;
|
using Robust.Client.Graphics.Drawing;
|
||||||
using Robust.Client.Interfaces.ResourceManagement;
|
using Robust.Client.Interfaces.ResourceManagement;
|
||||||
@@ -16,6 +16,11 @@ namespace Content.Client.UserInterface
|
|||||||
public const string StyleClassButtonBig = "ButtonBig";
|
public const string StyleClassButtonBig = "ButtonBig";
|
||||||
private static readonly Color NanoGold = Color.FromHex("#A88B5E");
|
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 Stylesheet Stylesheet { get; }
|
||||||
|
|
||||||
public NanoStyle()
|
public NanoStyle()
|
||||||
@@ -420,6 +425,22 @@ namespace Content.Client.UserInterface
|
|||||||
{
|
{
|
||||||
new StyleProperty("font", notoSans16)
|
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