Files
OldThink/Content.Client/Tools/Components/MultipleToolComponent.cs

40 lines
1.2 KiB
C#
Raw Permalink Normal View History

2021-06-09 22:19:39 +02:00
using Content.Client.Message;
using Content.Client.Stylesheets;
using Content.Shared.Tools.Components;
2020-01-09 00:27:52 +01:00
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
2021-06-09 22:19:39 +02:00
namespace Content.Client.Tools.Components
2020-01-09 00:27:52 +01:00
{
2022-08-16 22:19:54 +12:00
public sealed class MultipleToolStatusControl : Control
{
private readonly MultipleToolComponent _parent;
private readonly RichTextLabel _label;
2020-01-09 00:27:52 +01:00
2022-08-16 22:19:54 +12:00
public MultipleToolStatusControl(MultipleToolComponent parent)
2020-01-09 00:27:52 +01:00
{
2022-08-16 22:19:54 +12:00
_parent = parent;
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
_label.SetMarkup(_parent.StatusShowBehavior ? _parent.CurrentQualityName : string.Empty);
AddChild(_label);
2020-01-09 00:27:52 +01:00
}
2022-08-16 22:19:54 +12:00
protected override void FrameUpdate(FrameEventArgs args)
2020-01-09 00:27:52 +01:00
{
2022-08-16 22:19:54 +12:00
base.FrameUpdate(args);
2020-01-09 00:27:52 +01:00
2022-08-16 22:19:54 +12:00
if (_parent.UiUpdateNeeded)
2020-01-09 00:27:52 +01:00
{
2022-08-16 22:19:54 +12:00
_parent.UiUpdateNeeded = false;
Update();
}
2022-08-16 22:19:54 +12:00
}
2020-01-09 00:27:52 +01:00
2022-08-16 22:19:54 +12:00
public void Update()
{
_label.SetMarkup(_parent.StatusShowBehavior ? _parent.CurrentQualityName : string.Empty);
2020-01-09 00:27:52 +01:00
}
}
}