mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* redundant members * catch IonLawSystem instances * return the ion law sawmill, fix LogMan instances * SalvageSystem LogManager inst * IonLawSystem: public Sawmill * what even is initialization order?
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using Content.Client.Items;
|
|
using Content.Client.Message;
|
|
using Content.Client.Stylesheets;
|
|
using Content.Shared.Charges.Components;
|
|
using Content.Shared.Charges.Systems;
|
|
using Content.Shared.Crayon;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Client.Crayon;
|
|
|
|
public sealed partial class CrayonSystem : SharedCrayonSystem
|
|
{
|
|
[Dependency] private SharedChargesSystem _charges = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
Subs.ItemStatus<CrayonComponent>(ent => new StatusControl(ent, _charges, EntityManager));
|
|
}
|
|
|
|
private sealed class StatusControl : Control
|
|
{
|
|
private readonly Entity<CrayonComponent> _crayon;
|
|
private readonly SharedChargesSystem _charges;
|
|
private readonly RichTextLabel _label;
|
|
private readonly int _capacity;
|
|
|
|
public StatusControl(Entity<CrayonComponent> crayon, SharedChargesSystem charges, EntityManager entityManage)
|
|
{
|
|
_crayon = crayon;
|
|
_charges = charges;
|
|
_capacity = entityManage.GetComponent<LimitedChargesComponent>(_crayon.Owner).MaxCharges;
|
|
_label = new RichTextLabel { StyleClasses = { StyleClass.ItemStatus } };
|
|
AddChild(_label);
|
|
}
|
|
|
|
protected override void FrameUpdate(FrameEventArgs args)
|
|
{
|
|
base.FrameUpdate(args);
|
|
|
|
_label.SetMarkup(Robust.Shared.Localization.Loc.GetString("crayon-drawing-label",
|
|
("color", _crayon.Comp.Color),
|
|
("state", _crayon.Comp.SelectedState),
|
|
("charges", _charges.GetCurrentCharges(_crayon.Owner)),
|
|
("capacity", _capacity)));
|
|
}
|
|
}
|
|
}
|