Administration: Ahelp tabs (#5965)

This commit is contained in:
E F R
2022-01-03 00:54:44 +00:00
committed by GitHub
parent a3f21e9603
commit df9aecb6a0
14 changed files with 291 additions and 57 deletions

View File

@@ -0,0 +1,49 @@
#nullable enable
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Network;
using Robust.Shared.Utility;
namespace Content.Client.Administration.UI.CustomControls
{
[GenerateTypedNameReferences]
public partial class BwoinkPanel : BoxContainer
{
private readonly BwoinkSystem _bwoinkSystem;
public readonly NetUserId ChannelId;
public int Unread { get; private set; } = 0;
public BwoinkPanel(BwoinkSystem bwoinkSys, NetUserId userId)
{
RobustXamlLoader.Load(this);
_bwoinkSystem = bwoinkSys;
ChannelId = userId;
OnVisibilityChanged += c =>
{
if (c.Visible)
Unread = 0;
};
SenderLineEdit.OnTextEntered += Input_OnTextEntered;
}
private void Input_OnTextEntered(LineEdit.LineEditEventArgs args)
{
if (!string.IsNullOrWhiteSpace(args.Text))
_bwoinkSystem.Send(ChannelId, args.Text);
SenderLineEdit.Clear();
}
public void ReceiveLine(string text)
{
if (!Visible)
Unread++;
var formatted = new FormattedMessage(1);
formatted.AddMarkup(text);
TextOutput.AddMessage(formatted);
}
}
}