* camera * add console command * change verb name to camera * placeholder text * add button to player panel * orks are indeed the best * visibility flag fix * not a datafield * more follower fixes * more cleanup * add zooming * resizing real * remove commented out code * remove AddForceSend * comment * Use OS window and add some comments * fix comments and variable name * Needs RT update * Minor grammarchange * Fix warning * Cleanup * almost working... * fix bug * oswindow update * Remove need for RequestClosed. --------- Co-authored-by: beck-thompson <beck314159@hotmail.com> Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com>
75 lines
2.9 KiB
C#
75 lines
2.9 KiB
C#
using Content.Client.Administration.Managers;
|
|
using Content.Client.Eui;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Eui;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.Console;
|
|
using Robust.Client.UserInterface;
|
|
|
|
namespace Content.Client.Administration.UI.PlayerPanel;
|
|
|
|
[UsedImplicitly]
|
|
public sealed class PlayerPanelEui : BaseEui
|
|
{
|
|
[Dependency] private readonly IClientConsoleHost _console = default!;
|
|
[Dependency] private readonly IClientAdminManager _admin = default!;
|
|
[Dependency] private readonly IClipboardManager _clipboard = default!;
|
|
|
|
private PlayerPanel PlayerPanel { get; }
|
|
|
|
public PlayerPanelEui()
|
|
{
|
|
PlayerPanel = new PlayerPanel(_admin);
|
|
|
|
PlayerPanel.OnUsernameCopy += username => _clipboard.SetText(username);
|
|
PlayerPanel.OnOpenNotes += id => _console.ExecuteCommand($"adminnotes \"{id}\"");
|
|
// Kick command does not support GUIDs
|
|
PlayerPanel.OnKick += username => _console.ExecuteCommand($"kick \"{username}\"");
|
|
PlayerPanel.OnCamera += username => _console.ExecuteCommand($"camera \"{username}\"");
|
|
PlayerPanel.OnOpenBanPanel += id => _console.ExecuteCommand($"banpanel \"{id}\"");
|
|
PlayerPanel.OnOpenBans += id => _console.ExecuteCommand($"banlist \"{id}\"");
|
|
PlayerPanel.OnAhelp += id => _console.ExecuteCommand($"openahelp \"{id}\"");
|
|
PlayerPanel.OnWhitelistToggle += (id, whitelisted) =>
|
|
{
|
|
_console.ExecuteCommand(whitelisted ? $"whitelistremove \"{id}\"" : $"whitelistadd \"{id}\"");
|
|
};
|
|
|
|
PlayerPanel.OnFreezeAndMuteToggle += () => SendMessage(new PlayerPanelFreezeMessage(true));
|
|
PlayerPanel.OnFreeze += () => SendMessage(new PlayerPanelFreezeMessage());
|
|
PlayerPanel.OnLogs += () => SendMessage(new PlayerPanelLogsMessage());
|
|
PlayerPanel.OnRejuvenate += () => SendMessage(new PlayerPanelRejuvenationMessage());
|
|
PlayerPanel.OnDelete += () => SendMessage(new PlayerPanelDeleteMessage());
|
|
PlayerPanel.OnFollow += () => SendMessage(new PlayerPanelFollowMessage());
|
|
|
|
PlayerPanel.OnClose += () => SendMessage(new CloseEuiMessage());
|
|
}
|
|
|
|
public override void Opened()
|
|
{
|
|
PlayerPanel.OpenCentered();
|
|
}
|
|
|
|
public override void Closed()
|
|
{
|
|
PlayerPanel.Close();
|
|
}
|
|
|
|
public override void HandleState(EuiStateBase state)
|
|
{
|
|
if (state is not PlayerPanelEuiState s)
|
|
return;
|
|
|
|
PlayerPanel.TargetPlayer = s.Guid;
|
|
PlayerPanel.TargetUsername = s.Username;
|
|
PlayerPanel.SetUsername(s.Username);
|
|
PlayerPanel.SetPlaytime(s.Playtime);
|
|
PlayerPanel.SetBans(s.TotalBans, s.TotalRoleBans);
|
|
PlayerPanel.SetNotes(s.TotalNotes);
|
|
PlayerPanel.SetWhitelisted(s.Whitelisted);
|
|
PlayerPanel.SetSharedConnections(s.SharedConnections);
|
|
PlayerPanel.SetFrozen(s.CanFreeze, s.Frozen);
|
|
PlayerPanel.SetAhelp(s.CanAhelp);
|
|
PlayerPanel.SetButtons();
|
|
}
|
|
}
|