Add ban id to ban list, make ids label a button (#12700)
This commit is contained in:
@@ -46,13 +46,16 @@ public sealed partial class BanListControl : Control
|
||||
ClosePopup();
|
||||
|
||||
var ban = line.Ban;
|
||||
var id = ban.Id == null ? string.Empty : Loc.GetString("ban-list-id", ("id", ban.Id.Value));
|
||||
var ip = ban.Address == null
|
||||
? string.Empty
|
||||
: Loc.GetString("ban-list-ip", ("ip", ban.Address.Value.address));
|
||||
var hwid = ban.HWId == null ? string.Empty : Loc.GetString("ban-list-hwid", ("hwid", ban.HWId));
|
||||
var guid = ban.UserId == null ? string.Empty : Loc.GetString("ban-list-guid", ("guid", ban.UserId.Value.ToString()));
|
||||
var hwid = ban.HWId == null ? string.Empty : Loc.GetString("ban-list-hwid", ("hwid", ban.HWId));
|
||||
var guid = ban.UserId == null
|
||||
? string.Empty
|
||||
: Loc.GetString("ban-list-guid", ("guid", ban.UserId.Value.ToString()));
|
||||
|
||||
_popup = new BanListIdsPopup(ip, hwid, guid);
|
||||
_popup = new BanListIdsPopup(id, ip, hwid, guid);
|
||||
|
||||
var box = UIBox2.FromDimensions(UserInterfaceManager.MousePositionScaled.Position, (1, 1));
|
||||
_popup.Open(box);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<graphics:StyleBoxFlat BackgroundColor="#25252A"/>
|
||||
</PanelContainer.PanelOverride>
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<Label Name="ID" HorizontalExpand="True"/>
|
||||
<Label Name="IP" HorizontalExpand="True"/>
|
||||
<Label Name="HWId" HorizontalExpand="True"/>
|
||||
<Label Name="GUID" HorizontalExpand="True"/>
|
||||
|
||||
@@ -7,10 +7,11 @@ namespace Content.Client.Administration.UI.BanList;
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class BanListIdsPopup : Popup
|
||||
{
|
||||
public BanListIdsPopup(string? ip, string? hwid, string? guid)
|
||||
public BanListIdsPopup(string? id, string? ip, string? hwid, string? guid)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
ID.Text = id;
|
||||
IP.Text = ip;
|
||||
HWId.Text = hwid;
|
||||
GUID.Text = guid;
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
SizeFlagsStretchRatio="1"
|
||||
HorizontalExpand="True"
|
||||
RectClipContent="True">
|
||||
<Label Name="IdsHidden"
|
||||
Text="{Loc 'ban-list-hidden'}"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
MouseFilter="Pass"/>
|
||||
<Button Name="IdsHidden"
|
||||
Text="{Loc 'ban-list-view'}"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
MouseFilter="Pass"/>
|
||||
</BoxContainer>
|
||||
<cc:VSeparator/>
|
||||
<Label Name="Reason"
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using Content.Shared.Administration.BanList;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Input;
|
||||
|
||||
namespace Content.Client.Administration.UI.BanList;
|
||||
|
||||
@@ -20,7 +18,7 @@ public sealed partial class BanListLine : BoxContainer
|
||||
|
||||
Ban = ban;
|
||||
|
||||
IdsHidden.OnKeyBindDown += IdsKeyBindDown;
|
||||
IdsHidden.OnPressed += IdsPressed;
|
||||
|
||||
Reason.Text = ban.Reason;
|
||||
BanTime.Text = FormatDate(ban.BanTime);
|
||||
@@ -46,25 +44,16 @@ public sealed partial class BanListLine : BoxContainer
|
||||
return date.ToString("MM/dd/yyyy h:mm tt");
|
||||
}
|
||||
|
||||
private void IdsKeyBindDown(GUIBoundKeyEventArgs args)
|
||||
private void IdsPressed(BaseButton.ButtonEventArgs buttonEventArgs)
|
||||
{
|
||||
if (args.Function != EngineKeyFunctions.UIRightClick &&
|
||||
args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (OnIdsClicked?.Invoke(this) == true)
|
||||
{
|
||||
args.Handle();
|
||||
}
|
||||
OnIdsClicked?.Invoke(this);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
IdsHidden.OnKeyBindDown -= IdsKeyBindDown;
|
||||
IdsHidden.OnPressed -= IdsPressed;
|
||||
OnIdsClicked = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ ban-list-header-expires = Expires
|
||||
ban-list-header-banning-admin = Banning admin
|
||||
|
||||
ban-list-title = Bans for {$player}
|
||||
ban-list-hidden = Hidden
|
||||
ban-list-view = View
|
||||
ban-list-id = ID: {$id}
|
||||
ban-list-ip = IP: {$ip}
|
||||
ban-list-hwid = HWID: {$hwid}
|
||||
ban-list-guid = GUID: {$guid}
|
||||
|
||||
Reference in New Issue
Block a user