PlayerListControl fixes. (#25248)

* PlayerListControl fixes.

Fix a button being selected by default always, which then can't be selected properly for real. This affected multiple admin UIs.

This broke due to upstream RT changes but ButtonGroup was always kinda busted so whatever. Uses the new IsNoneSetAllowed to implement everything properly.

Also make sure the selected player STAYS selected when filtering the list and stuff.

Also this PlayerInfo record has been changed to only do equality on the User ID because otherwise it'd need to compare each field individually which would be weird.

* Revert changes to ListContainer

This change was made default in the engine, no longer necessary here.
This commit is contained in:
Pieter-Jan Briers
2024-02-20 10:13:48 +01:00
committed by GitHub
parent 2e6eaa45c5
commit 74a31ac5f3
2 changed files with 19 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Administration
{
[Serializable, NetSerializable]
public record PlayerInfo(
public sealed record PlayerInfo(
string Username,
string CharacterName,
string IdentityName,
@@ -20,5 +20,15 @@ namespace Content.Shared.Administration
public string PlaytimeString => _playtimeString ??=
OverallPlaytime?.ToString("%d':'hh':'mm") ?? Loc.GetString("generic-unknown-title");
public bool Equals(PlayerInfo? other)
{
return other?.SessionId == SessionId;
}
public override int GetHashCode()
{
return SessionId.GetHashCode();
}
}
}