Add player list to the ban window

the peptide special
This commit is contained in:
DrSmugleaf
2021-12-09 19:27:45 +01:00
parent 896f80831b
commit ceca68236c
2 changed files with 19 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
<SS14Window <SS14Window
xmlns="https://spacestation14.io" xmlns="https://spacestation14.io"
Title="{Loc Ban}" MinSize="425 162"> xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="{Loc Ban}" MinSize="425 325">
<BoxContainer Orientation="Vertical"> <BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal"> <BoxContainer Orientation="Horizontal">
<Label Text="{Loc Player}" MinWidth="100" /> <Label Text="{Loc Player}" MinWidth="100" />
@@ -17,6 +18,7 @@
<Control MinWidth="50" /> <Control MinWidth="50" />
<LineEdit Name="MinutesLine" MinWidth="100" HorizontalExpand="True" PlaceHolder="{Loc 0 minutes for a permanent ban}" /> <LineEdit Name="MinutesLine" MinWidth="100" HorizontalExpand="True" PlaceHolder="{Loc 0 minutes for a permanent ban}" />
</BoxContainer> </BoxContainer>
<cc:PlayerListControl Name="PlayerList" VerticalExpand="True" />
<Control MinWidth="50" /> <Control MinWidth="50" />
<Button Name="SubmitButton" Text="{Loc Ban}" /> <Button Name="SubmitButton" Text="{Loc Ban}" />
</BoxContainer> </BoxContainer>

View File

@@ -1,10 +1,12 @@
using JetBrains.Annotations; using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.Console; using Robust.Client.Console;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.LineEdit;
namespace Content.Client.Administration.UI.Tabs.AdminTab namespace Content.Client.Administration.UI.Tabs.AdminTab
{ {
@@ -12,18 +14,29 @@ namespace Content.Client.Administration.UI.Tabs.AdminTab
[UsedImplicitly] [UsedImplicitly]
public partial class BanWindow : SS14Window public partial class BanWindow : SS14Window
{ {
protected override void EnteredTree() protected override void EnteredTree()
{ {
PlayerNameLine.OnTextChanged += PlayerNameLineOnOnTextChanged; PlayerNameLine.OnTextChanged += PlayerNameLineOnOnTextChanged;
PlayerList.OnSelectionChanged += OnPlayerSelectionChanged;
SubmitButton.OnPressed += SubmitButtonOnOnPressed; SubmitButton.OnPressed += SubmitButtonOnOnPressed;
} }
private void PlayerNameLineOnOnTextChanged(LineEdit.LineEditEventArgs obj) private void OnPlayerNameChanged()
{ {
SubmitButton.Disabled = string.IsNullOrEmpty(PlayerNameLine.Text); SubmitButton.Disabled = string.IsNullOrEmpty(PlayerNameLine.Text);
} }
private void PlayerNameLineOnOnTextChanged(LineEditEventArgs obj)
{
OnPlayerNameChanged();
}
private void OnPlayerSelectionChanged(PlayerInfo? player)
{
PlayerNameLine.Text = player?.Username ?? string.Empty;
OnPlayerNameChanged();
}
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj) private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{ {
// Small verification if Player Name exists // Small verification if Player Name exists