Renames KickWindow, adds a Respawn command button. (#4791)
* Renames KickWindow, adds a Respawn command button. * Additionally fix PlayerActionsWindow not correctly having the buttons disabled on open.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Administration.UI.Tabs.AdminTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
public partial class PlayerActionsWindow : SS14Window
|
||||
{
|
||||
private ICommonSession? _selectedSession;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
SubmitKickButton.OnPressed += SubmitKickButtonOnPressed;
|
||||
SubmitAHelpButton.OnPressed += SubmitAhelpButtonOnPressed;
|
||||
SubmitRespawnButton.OnPressed += SubmitRespawnButtonOnPressed;
|
||||
PlayerList.OnSelectionChanged += OnListOnOnSelectionChanged;
|
||||
}
|
||||
|
||||
private void OnListOnOnSelectionChanged(ICommonSession? obj)
|
||||
{
|
||||
_selectedSession = obj;
|
||||
var disableButtons = _selectedSession == null;
|
||||
SubmitKickButton.Disabled = disableButtons;
|
||||
SubmitAHelpButton.Disabled = disableButtons;
|
||||
SubmitRespawnButton.Disabled = disableButtons;
|
||||
}
|
||||
|
||||
private void SubmitKickButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_selectedSession == null)
|
||||
return;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"kick \"{_selectedSession.Name}\" \"{CommandParsing.Escape(ReasonLine.Text)}\"");
|
||||
}
|
||||
|
||||
private void SubmitAhelpButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_selectedSession == null)
|
||||
return;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"openahelp \"{_selectedSession.UserId}\"");
|
||||
}
|
||||
|
||||
private void SubmitRespawnButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_selectedSession == null)
|
||||
return;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"respawn \"{_selectedSession.Name}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user