Enhanced APC UI + New NT logo to footer (#14258)
This commit is contained in:
@@ -1,25 +1,29 @@
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using System;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.APC;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using FancyWindow = Content.Client.UserInterface.Controls.FancyWindow;
|
||||
|
||||
namespace Content.Client.Power.APC.UI
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class ApcMenu : DefaultWindow
|
||||
public sealed partial class ApcMenu : FancyWindow
|
||||
{
|
||||
public ApcMenu(ApcBoundUserInterface owner)
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
public ApcMenu(ApcBoundUserInterface owner, ClientUserInterfaceComponent component)
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
EntityView.Sprite = _entityManager.GetComponent<SpriteComponent>(component.Owner);
|
||||
BreakerButton.OnPressed += _ => owner.BreakerPressed();
|
||||
}
|
||||
|
||||
@@ -29,12 +33,22 @@ namespace Content.Client.Power.APC.UI
|
||||
|
||||
if (BreakerButton != null)
|
||||
{
|
||||
BreakerButton.Pressed = castState.MainBreaker;
|
||||
if(castState.HasAccess == false)
|
||||
{
|
||||
BreakerButton.Disabled = true;
|
||||
BreakerButton.ToolTip = Loc.GetString("apc-component-insufficient-access");
|
||||
}
|
||||
else
|
||||
{
|
||||
BreakerButton.Disabled = false;
|
||||
BreakerButton.ToolTip = null;
|
||||
BreakerButton.Pressed = castState.MainBreaker;
|
||||
}
|
||||
}
|
||||
|
||||
if (PowerLabel != null)
|
||||
{
|
||||
PowerLabel.Text = Loc.GetString("apc-menu-power-label", ("power", castState.Power));
|
||||
PowerLabel.Text = castState.Power + "W";
|
||||
}
|
||||
|
||||
if (ExternalPowerStateLabel != null)
|
||||
@@ -62,12 +76,8 @@ namespace Content.Client.Power.APC.UI
|
||||
{
|
||||
ChargeBar.Value = castState.Charge;
|
||||
UpdateChargeBarColor(castState.Charge);
|
||||
|
||||
if (APCMenu != null)
|
||||
{
|
||||
var chargePercentage = (castState.Charge / ChargeBar.MaxValue) * 100.0f;
|
||||
ChargePercentage.Text = " " + chargePercentage.ToString("0.00") + "%";
|
||||
}
|
||||
var chargePercentage = (castState.Charge / ChargeBar.MaxValue);
|
||||
ChargePercentage.Text = Loc.GetString("apc-menu-charge-label",("percent", chargePercentage.ToString("P0")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user