* Always display item status panel fully Initial feedback from the UI changes seems to be that a lot of people go "why is there empty space" so let's fix that. * Fix item status middle hand being on the wrong side I think I switched this around when fixing the left/right being inverted in the UI code. * Minor status panel UI tweaks Bottom-align contents now that the panel itself doesn't dynamically expand, prevent weird gaps. Clip contents for panel * Fix clipping on implanters and network configurators. Made them take less space. For implanters the name has to be cut off, which I did by adding a new ClipControl to achieve that in rich text. * Update visibility of item status panels based on whether you have hands at all. This avoids UI for borgs looking silly. Added a new "HandUILocation" enum that doesn't have middle hands to avoid confusion in UI code. * Use BulletRender for laser guns too. Provides all the benefits like fixing layout overflow and allowing multi-line stuff. Looks great now. This involved generalizing BulletRender a bit so it can be used for not-just-bullets. * Fix geiger word wrapping if you're really fucked
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using Content.Client.Message;
|
|
using Content.Client.Stylesheets;
|
|
using Content.Client.UserInterface.Controls;
|
|
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(new ClipControl { Children = { _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 = _parent.ImplanterSlot.HasItem
|
|
? _parent.ImplantData.Item1
|
|
: Loc.GetString("implanter-empty-text");
|
|
|
|
_label.SetMarkup(Loc.GetString("implanter-label",
|
|
("implantName", implantName),
|
|
("modeString", modeStringLocalized)));
|
|
}
|
|
}
|