* eye on the prize * OnStackInteractUsing, TryMergeStacks, TryMergeToHands, TryMergeToContacts * namespace * Use, get count, getMaxCount * component access * add regions, mark TODO * obsolete TryAdd, public TryMergeStacks * GetMaxCount * event handlers * event handlers * SetCount * client server event handlers * move to shared * Revert "move to shared" This reverts commit 45540a2d6b8e1e6d2a8f83a584267776c7edcd73. * misc changes to shared * split * spawn and SpawnNextToOrDrop * SpawnMultipleAtPosition, SpawnMultipleNextToOrDrop, CalculateSpawns, general server cleanup * Rename Use to TryUse. * Small misc changes * Remove obsolete functions * Remove some SetCount calls * Partialize * small misc change * don't nuke the git dif with the namespace block * Comments and reordering * touchup to UpdateLingering * Summary comment for StackStatusControl * Last pass * Actual last pass (for now) * I know myself too well * fixup * goodbye lingering * fixes * review * fix test * second look * fix test * forgot * remove early comp getting --------- Co-authored-by: iaada <iaada@users.noreply.github.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using Content.Client.Message;
|
|
using Content.Client.Stylesheets;
|
|
using Content.Shared.Stacks;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Client.Stack;
|
|
|
|
/// <summary>
|
|
/// Used by hands in player UI to display the stack count.
|
|
/// </summary>
|
|
public sealed class StackStatusControl : Control
|
|
{
|
|
private readonly StackComponent _parent;
|
|
private readonly RichTextLabel _label;
|
|
|
|
public StackStatusControl(StackComponent parent)
|
|
{
|
|
_parent = parent;
|
|
_label = new RichTextLabel {StyleClasses = {StyleClass.ItemStatus}};
|
|
_label.SetMarkup(Loc.GetString("comp-stack-status", ("count", _parent.Count)));
|
|
AddChild(_label);
|
|
}
|
|
|
|
protected override void FrameUpdate(FrameEventArgs args)
|
|
{
|
|
base.FrameUpdate(args);
|
|
|
|
if (!_parent.UiUpdateNeeded)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_parent.UiUpdateNeeded = false;
|
|
|
|
_label.SetMarkup(Loc.GetString("comp-stack-status", ("count", _parent.Count)));
|
|
}
|
|
}
|