submodule update & fixes the ahelpwindow further

This commit is contained in:
Paul
2022-01-03 04:14:10 +01:00
parent 7e266b41ff
commit 33572c5cc8
5 changed files with 25 additions and 17 deletions

View File

@@ -24,14 +24,6 @@ namespace Content.Client.Administration
} }
} }
public List<PlayerInfo> GetSortedPlayerList(Comparison<PlayerInfo> comparison)
{
if (_playerList == null) return new List<PlayerInfo>();
var list = _playerList.Values.ToList();
list.Sort(comparison);
return list;
}
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();

View File

@@ -62,10 +62,10 @@ namespace Content.Client.Administration.UI
return 0; return 0;
if (!aChannelExists) if (!aChannelExists)
return -1; return 1;
if (!bChannelExists) if (!bChannelExists)
return 1; return -1;
return bch!.LastMessage.CompareTo(ach!.LastMessage); return bch!.LastMessage.CompareTo(ach!.LastMessage);
}; };
@@ -103,7 +103,8 @@ namespace Content.Client.Administration.UI
var open = IsOpen; var open = IsOpen;
Open(); Open();
ChannelSelector.Refresh(); ChannelSelector.RefreshDecorators();
ChannelSelector.Sort();
if (!open) if (!open)
{ {

View File

@@ -16,7 +16,7 @@ namespace Content.Client.Administration.UI.CustomControls
public readonly NetUserId ChannelId; public readonly NetUserId ChannelId;
public int Unread { get; private set; } = 0; public int Unread { get; private set; } = 0;
public DateTime LastMessage { get; private set; } public DateTime LastMessage { get; private set; } = DateTime.MinValue;
public BwoinkPanel(BwoinkSystem bwoinkSys, NetUserId userId) public BwoinkPanel(BwoinkSystem bwoinkSys, NetUserId userId)
{ {
@@ -34,9 +34,10 @@ namespace Content.Client.Administration.UI.CustomControls
private void Input_OnTextEntered(LineEdit.LineEditEventArgs args) private void Input_OnTextEntered(LineEdit.LineEditEventArgs args)
{ {
if (!string.IsNullOrWhiteSpace(args.Text)) if (string.IsNullOrWhiteSpace(args.Text))
_bwoinkSystem.Send(ChannelId, args.Text); return;
_bwoinkSystem.Send(ChannelId, args.Text);
SenderLineEdit.Clear(); SenderLineEdit.Clear();
} }

View File

@@ -53,13 +53,25 @@ namespace Content.Client.Administration.UI.CustomControls
OnSelectionChanged?.Invoke(null); OnSelectionChanged?.Invoke(null);
} }
public void Refresh() => PopulateList(); public void RefreshDecorators()
{
foreach (var item in PlayerItemList)
{
DecoratePlayer?.Invoke((PlayerInfo) item.Metadata!, item);
}
}
public void Sort()
{
if(Comparison != null)
PlayerItemList.Sort((a, b) => Comparison((PlayerInfo) a.Metadata!, (PlayerInfo) b.Metadata!));
}
private void PopulateList(IReadOnlyList<PlayerInfo> _ = null!) private void PopulateList(IReadOnlyList<PlayerInfo> _ = null!)
{ {
PlayerItemList.Clear(); PlayerItemList.Clear();
foreach (var info in Comparison == null ? _adminSystem.PlayerList : _adminSystem.GetSortedPlayerList(Comparison)) foreach (var info in _adminSystem.PlayerList)
{ {
var displayName = $"{info.CharacterName} ({info.Username})"; var displayName = $"{info.CharacterName} ({info.Username})";
if (!string.IsNullOrEmpty(FilterLineEdit.Text) && if (!string.IsNullOrEmpty(FilterLineEdit.Text) &&
@@ -76,6 +88,8 @@ namespace Content.Client.Administration.UI.CustomControls
DecoratePlayer?.Invoke(info, item); DecoratePlayer?.Invoke(info, item);
PlayerItemList.Add(item); PlayerItemList.Add(item);
} }
Sort();
} }
} }
} }