2023-07-28 15:52:06 -04:00
|
|
|
using Content.Client.Message;
|
2022-11-20 01:49:37 -05:00
|
|
|
using Content.Client.Stylesheets;
|
2024-04-24 16:01:31 +02:00
|
|
|
using Content.Client.UserInterface.Controls;
|
2022-11-20 01:49:37 -05:00
|
|
|
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 } };
|
2023-07-28 15:52:06 -04:00
|
|
|
_label.MaxWidth = 350;
|
2024-04-24 16:01:31 +02:00
|
|
|
AddChild(new ClipControl { Children = { _label } });
|
2022-11-20 01:49:37 -05:00
|
|
|
|
|
|
|
|
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")
|
|
|
|
|
};
|
|
|
|
|
|
2024-04-24 16:01:31 +02:00
|
|
|
var implantName = _parent.ImplanterSlot.HasItem
|
|
|
|
|
? _parent.ImplantData.Item1
|
|
|
|
|
: Loc.GetString("implanter-empty-text");
|
2022-11-20 01:49:37 -05:00
|
|
|
|
2023-07-28 15:52:06 -04:00
|
|
|
_label.SetMarkup(Loc.GetString("implanter-label",
|
|
|
|
|
("implantName", implantName),
|
2024-04-24 16:01:31 +02:00
|
|
|
("modeString", modeStringLocalized)));
|
2022-11-20 01:49:37 -05:00
|
|
|
}
|
|
|
|
|
}
|