Files
tbd-station-14/Content.Client/Implants/UI/ImplanterStatusControl.cs
Vordenburg 0330ea7553 Improve implanter descriptions (#18403)
* Rewrite all implanter and implant descriptions

* Make implanter status control resemble syringe's

* Add implant description to implanter examine

* Remove unused usings
2023-07-28 13:52:06 -06:00

59 lines
1.7 KiB
C#

using Content.Client.Message;
using Content.Client.Stylesheets;
using Content.Shared.Implants.Components;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
namespace Content.Client.Implants.UI;
public sealed class ImplanterStatusControl : Control
{
private readonly ImplanterComponent _parent;
private readonly RichTextLabel _label;
public ImplanterStatusControl(ImplanterComponent parent)
{
_parent = parent;
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
_label.MaxWidth = 350;
AddChild(_label);
Update();
}
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
if (!_parent.UiUpdateNeeded)
return;
Update();
}
private void Update()
{
_parent.UiUpdateNeeded = false;
var modeStringLocalized = _parent.CurrentMode switch
{
ImplanterToggleMode.Draw => Loc.GetString("implanter-draw-text"),
ImplanterToggleMode.Inject => Loc.GetString("implanter-inject-text"),
_ => Loc.GetString("injector-invalid-injector-toggle-mode")
};
var (implantName, implantDescription) = _parent.ImplanterSlot.HasItem switch
{
false => (Loc.GetString("implanter-empty-text"), ""),
true => (_parent.ImplantData.Item1, _parent.ImplantData.Item2),
};
_label.SetMarkup(Loc.GetString("implanter-label",
("implantName", implantName),
("implantDescription", implantDescription),
("modeString", modeStringLocalized),
("lineBreak", "\n")));
}
}