Files
tbd-station-14/Content.Client/Administration/UI/CustomControls/BwoinkPanel.xaml.cs
Moony f98df73fae Adds even more smites and a bunch of tools. (#9825)
* Adds three new smites, headstand, locker stuff, and reptilian species swap.

* Localize all the smites.

* save work

* More smites...

* Final tweaks.

* oops

* !PLEH

* Adds disarm prone and improved hand removal options.

* fix chances.

* take out the trash.

* Add some admin TRICKS instead of more smites.

* oop

* Implements the admin test arena and associated trick.

* Tricks for granting/revoking access.

* e

* mfw

* Implement quick dialogs, for when you don't want to spend 20 minutes writing a simple dialog prompt.

* Forgot the rejuv icon.

* E

* docs

* augh

* Add rename/redescribe buttons.

* Adds objects menu, implements a couple tricks for stations.

* 1984

* Adds a trick for effectively infinite power.

* fixes some icon uggo.

* a

* HALT!

* Pause/unpause buttons.

* Forgor the textures.

* they broke every bone in their body.

* i added more

* more battery actions, touch up battery icon.

* Address reviews.
2022-07-21 17:30:00 -05:00

57 lines
1.7 KiB
C#

#nullable enable
using System;
using Content.Client.Administration.Systems;
using Content.Shared.Administration;
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 sealed partial class BwoinkPanel : BoxContainer
{
private readonly BwoinkSystem _bwoinkSystem;
public readonly NetUserId ChannelId;
public int Unread { get; private set; } = 0;
public DateTime LastMessage { get; private set; } = DateTime.MinValue;
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))
return;
_bwoinkSystem.Send(ChannelId, args.Text);
SenderLineEdit.Clear();
}
public void ReceiveLine(SharedBwoinkSystem.BwoinkTextMessage message)
{
if (!Visible)
Unread++;
var formatted = new FormattedMessage(1);
formatted.AddMarkup($"[color=gray]{message.SentAt.ToShortTimeString()}[/color] {message.Text}");
TextOutput.AddMessage(formatted);
LastMessage = message.SentAt;
}
}
}