Show ban and note count in ahelp window (#15328)

This commit is contained in:
DrSmugleaf
2023-04-11 17:34:25 -07:00
committed by GitHub
parent 98b4af8df0
commit 26cd16eeaa
13 changed files with 142 additions and 34 deletions

View File

@@ -6,13 +6,11 @@ using Content.Client.Administration.UI.CustomControls;
using Content.Client.Administration.UI.Tabs.AdminTab;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Systems.Bwoink;
using Content.Client.UserInterface.Systems.Chat.Controls;
using Content.Shared.Administration;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Network;
using Robust.Shared.Utility;
@@ -51,9 +49,17 @@ namespace Content.Client.Administration.UI.Bwoink
ChannelSelector.OnSelectionChanged += sel =>
{
_currentPlayer = sel;
if (sel is not null)
if (sel == null)
{
SetPlayerActionsVisibility(false);
}
else
{
SwitchToChannel(sel.SessionId);
SetPlayerActionsVisibility(true);
Bans.Text = Loc.GetString("admin-player-actions-bans", ("count", sel.Bans));
Notes.Text = Loc.GetString("admin-player-actions-notes", ("count", sel.Notes));
}
ChannelSelector.PlayerListContainer.DirtyList();
@@ -164,6 +170,8 @@ namespace Content.Client.Administration.UI.Bwoink
{
uiController.PopOut();
};
SetPlayerActionsVisibility(_currentPlayer != null);
}
private Dictionary<Control, (CancellationTokenSource cancellation, string? originalText)> Confirmations { get; } = new();
@@ -245,8 +253,7 @@ namespace Content.Client.Administration.UI.Bwoink
{
foreach (var bw in BwoinkArea.Children)
bw.Visible = false;
var panel = AHelpHelper.EnsurePanel(ch);
panel.Visible = true;
AHelpHelper.EnsurePanel(ch).Visible = true;
}
private bool TryConfirm(Button button)
@@ -273,5 +280,15 @@ namespace Content.Client.Administration.UI.Bwoink
button.Text = Loc.GetString("admin-player-actions-confirm");
return false;
}
private void SetPlayerActionsVisibility(bool visible)
{
Bans.Visible = visible;
Notes.Visible = visible;
Kick.Visible = visible;
Ban.Visible = visible;
Respawn.Visible = visible;
Teleport.Visible = visible;
}
}
}