Add indicator showing amount of ghost roles available (#5150)

* Add indicator showing amount of ghost roles available

* Make the indicator turn red if ghost roles are available
This commit is contained in:
20kdc
2021-11-03 23:48:12 +00:00
committed by GitHub
parent 3ab4a30a0f
commit 9eb6e5a109
5 changed files with 77 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
using Content.Client.Stylesheets;
using Content.Shared.Ghost;
using Robust.Client.Console;
using Robust.Client.UserInterface;
@@ -13,16 +14,18 @@ namespace Content.Client.Ghost.UI
{
private readonly Button _returnToBody = new() {Text = Loc.GetString("ghost-gui-return-to-body-button") };
private readonly Button _ghostWarp = new() {Text = Loc.GetString("ghost-gui-ghost-warp-button") };
private readonly Button _ghostRoles = new() {Text = Loc.GetString("ghost-gui-ghost-roles-button") };
private readonly Button _ghostRoles = new();
private readonly GhostComponent _owner;
private readonly GhostSystem _system;
public GhostTargetWindow? TargetWindow { get; }
public GhostGui(GhostComponent owner, IEntityNetworkManager eventBus)
public GhostGui(GhostComponent owner, GhostSystem system, IEntityNetworkManager eventBus)
{
IoCManager.InjectDependencies(this);
_owner = owner;
_system = system;
TargetWindow = new GhostTargetWindow(eventBus);
@@ -57,6 +60,15 @@ namespace Content.Client.Ghost.UI
public void Update()
{
_returnToBody.Disabled = !_owner.CanReturnToBody;
_ghostRoles.Text = Loc.GetString("ghost-gui-ghost-roles-button", ("count", _system.AvailableGhostRoleCount));
if (_system.AvailableGhostRoleCount != 0)
{
_ghostRoles.StyleClasses.Add(StyleBase.ButtonCaution);
}
else
{
_ghostRoles.StyleClasses.Remove(StyleBase.ButtonCaution);
}
TargetWindow?.Populate();
}