Various item status fixes/tweaks (#27267)

* 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
This commit is contained in:
Pieter-Jan Briers
2024-04-24 16:01:31 +02:00
committed by GitHub
parent 38f490e5eb
commit 7b90c08a2c
16 changed files with 338 additions and 185 deletions

View File

@@ -1,17 +1,13 @@
using System.Numerics;
using Content.Client.Items;
using Content.Client.Resources;
using Content.Shared.Hands.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Inventory.VirtualItem;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using static Content.Client.IoC.StaticIoC;
namespace Content.Client.UserInterface.Systems.Inventory.Controls;
@@ -23,17 +19,15 @@ public sealed partial class ItemStatusPanel : Control
[ViewVariables] private EntityUid? _entity;
// Tracked so we can re-run SetSide() if the theme changes.
private HandLocation _side;
private HandUILocation _side;
public ItemStatusPanel()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
SetSide(HandLocation.Middle);
}
public void SetSide(HandLocation location)
public void SetSide(HandUILocation location)
{
// AN IMPORTANT REMINDER ABOUT THIS CODE:
// In the UI, the RIGHT hand is on the LEFT on the screen.
@@ -47,15 +41,14 @@ public sealed partial class ItemStatusPanel : Control
switch (location)
{
case HandLocation.Right:
case HandUILocation.Right:
texture = Theme.ResolveTexture("item_status_right");
textureHighlight = Theme.ResolveTexture("item_status_right_highlight");
cutOut = StyleBox.Margin.Left;
flat = StyleBox.Margin.Right;
contentMargin = MarginFromThemeColor("_itemstatus_content_margin_right");
break;
case HandLocation.Middle:
case HandLocation.Left:
case HandUILocation.Left:
texture = Theme.ResolveTexture("item_status_left");
textureHighlight = Theme.ResolveTexture("item_status_left_highlight");
cutOut = StyleBox.Margin.Right;
@@ -104,11 +97,14 @@ public sealed partial class ItemStatusPanel : Control
public void Update(EntityUid? entity)
{
ItemNameLabel.Visible = entity != null;
NoItemLabel.Visible = entity == null;
if (entity == null)
{
ItemNameLabel.Text = "";
ClearOldStatus();
_entity = null;
VisWrapper.Visible = false;
return;
}
@@ -119,8 +115,6 @@ public sealed partial class ItemStatusPanel : Control
UpdateItemName();
}
VisWrapper.Visible = true;
}
public void UpdateHighlight(bool highlight)