removes a bit of jank from bwoinkwindow
sorta fixes sorting
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
@@ -14,6 +16,7 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
public readonly NetUserId ChannelId;
|
||||
|
||||
public int Unread { get; private set; } = 0;
|
||||
public DateTime LastMessage { get; private set; }
|
||||
|
||||
public BwoinkPanel(BwoinkSystem bwoinkSys, NetUserId userId)
|
||||
{
|
||||
@@ -37,13 +40,15 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
SenderLineEdit.Clear();
|
||||
}
|
||||
|
||||
public void ReceiveLine(string text)
|
||||
public void ReceiveLine(SharedBwoinkSystem.BwoinkTextMessage message)
|
||||
{
|
||||
if (!Visible)
|
||||
Unread++;
|
||||
|
||||
var formatted = new FormattedMessage(1);
|
||||
formatted.AddMarkup(text);
|
||||
formatted.AddMarkup($"[color=gray]{message.SentAt.ToShortTimeString()}[/color] {message.Text}");
|
||||
TextOutput.AddMessage(formatted);
|
||||
LastMessage = message.SentAt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
public event Action<PlayerInfo?>? OnSelectionChanged;
|
||||
|
||||
public Action<PlayerInfo, ItemList.Item>? DecoratePlayer;
|
||||
public Func<PlayerInfo, int>? SortKey;
|
||||
public Comparison<PlayerInfo>? Comparison;
|
||||
|
||||
public PlayerListControl()
|
||||
{
|
||||
@@ -59,11 +59,7 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
{
|
||||
PlayerItemList.Clear();
|
||||
|
||||
IEnumerable<PlayerInfo> iter = _adminSystem.PlayerList;
|
||||
if (SortKey is not null)
|
||||
iter = _adminSystem.PlayerList.OrderByDescending(SortKey);
|
||||
|
||||
foreach (var info in iter)
|
||||
foreach (var info in Comparison == null ? _adminSystem.PlayerList : _adminSystem.GetSortedPlayerList(Comparison))
|
||||
{
|
||||
var displayName = $"{info.CharacterName} ({info.Username})";
|
||||
if (!string.IsNullOrEmpty(FilterLineEdit.Text) &&
|
||||
|
||||
Reference in New Issue
Block a user