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:
moonheart08
2021-10-07 16:48:47 -05:00
committed by GitHub
parent 0b57420d6e
commit 401974d549
5 changed files with 26 additions and 15 deletions

View File

@@ -7,7 +7,7 @@
MinSize="50 50"> MinSize="50 50">
<BoxContainer Orientation="Vertical"> <BoxContainer Orientation="Vertical">
<GridContainer Columns="4"> <GridContainer Columns="4">
<cc:UICommandButton Command="kick" Text="{Loc admin-kick-window-title}" WindowType="{x:Type at:KickWindow}" /> <cc:UICommandButton Command="kick" Text="{Loc admin-player-actions-window-title}" WindowType="{x:Type at:PlayerActionsWindow}" />
<cc:UICommandButton Command="ban" Text="{Loc Ban}" WindowType="{x:Type at:BanWindow}" /> <cc:UICommandButton Command="ban" Text="{Loc Ban}" WindowType="{x:Type at:BanWindow}" />
<cc:CommandButton Command="aghost" Text="{Loc Admin Ghost}" /> <cc:CommandButton Command="aghost" Text="{Loc Admin Ghost}" />
<cc:UICommandButton Command="tpto" Text="{Loc Teleport}" WindowType="{x:Type at:TeleportWindow}" /> <cc:UICommandButton Command="tpto" Text="{Loc Teleport}" WindowType="{x:Type at:TeleportWindow}" />

View File

@@ -1,7 +1,7 @@
<SS14Window <SS14Window
xmlns="https://spacestation14.io" xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls" xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="{Loc admin-kick-window-title}" MinSize="425 272"> Title="{Loc admin-player-actions-window-title}" MinSize="425 272">
<BoxContainer Orientation="Vertical"> <BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal"> <BoxContainer Orientation="Horizontal">
<Label Text="{Loc Reason}" MinWidth="100" /> <Label Text="{Loc Reason}" MinWidth="100" />
@@ -10,8 +10,9 @@
</BoxContainer> </BoxContainer>
<cc:PlayerListControl Name="PlayerList" VerticalExpand="True" /> <cc:PlayerListControl Name="PlayerList" VerticalExpand="True" />
<BoxContainer Orientation="Horizontal"> <BoxContainer Orientation="Horizontal">
<Button Name="SubmitButton" Text="{Loc admin-kick-window-kick-text}" /> <Button Name="SubmitKickButton" Text="{Loc admin-player-actions-window-kick-text}" Disabled="True"/>
<Button Name="SubmitAHButton" Text="{Loc admin-kick-window-ahelp-text}" /> <Button Name="SubmitAHelpButton" Text="{Loc admin-player-actions-window-ahelp-text}" Disabled="True"/>
<Button Name="SubmitRespawnButton" Text="{Loc admin-player-actions-window-respawn-text}" Disabled="True"/>
</BoxContainer> </BoxContainer>
</BoxContainer> </BoxContainer>
</SS14Window> </SS14Window>

View File

@@ -11,14 +11,15 @@ namespace Content.Client.Administration.UI.Tabs.AdminTab
{ {
[GenerateTypedNameReferences] [GenerateTypedNameReferences]
[UsedImplicitly] [UsedImplicitly]
public partial class KickWindow : SS14Window public partial class PlayerActionsWindow : SS14Window
{ {
private ICommonSession? _selectedSession; private ICommonSession? _selectedSession;
protected override void EnteredTree() protected override void EnteredTree()
{ {
SubmitButton.OnPressed += SubmitButtonOnOnPressed; SubmitKickButton.OnPressed += SubmitKickButtonOnPressed;
SubmitAHButton.OnPressed += SubmitAHButtonOnOnPressed; SubmitAHelpButton.OnPressed += SubmitAhelpButtonOnPressed;
SubmitRespawnButton.OnPressed += SubmitRespawnButtonOnPressed;
PlayerList.OnSelectionChanged += OnListOnOnSelectionChanged; PlayerList.OnSelectionChanged += OnListOnOnSelectionChanged;
} }
@@ -26,11 +27,12 @@ namespace Content.Client.Administration.UI.Tabs.AdminTab
{ {
_selectedSession = obj; _selectedSession = obj;
var disableButtons = _selectedSession == null; var disableButtons = _selectedSession == null;
SubmitButton.Disabled = disableButtons; SubmitKickButton.Disabled = disableButtons;
SubmitAHButton.Disabled = disableButtons; SubmitAHelpButton.Disabled = disableButtons;
SubmitRespawnButton.Disabled = disableButtons;
} }
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj) private void SubmitKickButtonOnPressed(BaseButton.ButtonEventArgs obj)
{ {
if (_selectedSession == null) if (_selectedSession == null)
return; return;
@@ -38,12 +40,20 @@ namespace Content.Client.Administration.UI.Tabs.AdminTab
$"kick \"{_selectedSession.Name}\" \"{CommandParsing.Escape(ReasonLine.Text)}\""); $"kick \"{_selectedSession.Name}\" \"{CommandParsing.Escape(ReasonLine.Text)}\"");
} }
private void SubmitAHButtonOnOnPressed(BaseButton.ButtonEventArgs obj) private void SubmitAhelpButtonOnPressed(BaseButton.ButtonEventArgs obj)
{ {
if (_selectedSession == null) if (_selectedSession == null)
return; return;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand( IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"openahelp \"{_selectedSession.UserId}\""); $"openahelp \"{_selectedSession.UserId}\"");
} }
private void SubmitRespawnButtonOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_selectedSession == null)
return;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"respawn \"{_selectedSession.Name}\"");
}
} }
} }

View File

@@ -1,4 +0,0 @@
admin-kick-window-title = Player Actions Panel
admin-kick-window-kick-text = Kick
admin-kick-window-ahelp-text = AHelp

View File

@@ -0,0 +1,4 @@
admin-player-actions-window-title = Player Actions Panel
admin-player-actions-window-kick-text = Kick
admin-player-actions-window-ahelp-text = AHelp
admin-player-actions-window-respawn-text = Respawn