Fix new players added to admin logs always defaulting to selected (#19104)
This commit is contained in:
@@ -420,14 +420,18 @@ public sealed partial class AdminLogsControl : Control
|
|||||||
public void SetPlayers(Dictionary<Guid, string> players)
|
public void SetPlayers(Dictionary<Guid, string> players)
|
||||||
{
|
{
|
||||||
var buttons = new SortedSet<AdminLogPlayerButton>(_adminLogPlayerButtonComparer);
|
var buttons = new SortedSet<AdminLogPlayerButton>(_adminLogPlayerButtonComparer);
|
||||||
|
var allSelected = true;
|
||||||
|
|
||||||
foreach (var control in PlayersContainer.Children.ToArray())
|
foreach (var control in PlayersContainer.Children.ToArray())
|
||||||
{
|
{
|
||||||
if (control is not AdminLogPlayerButton player ||
|
if (control is not AdminLogPlayerButton player)
|
||||||
!players.Remove(player.Id))
|
continue;
|
||||||
{
|
|
||||||
|
if (!SelectedPlayers.Contains(player.Id))
|
||||||
|
allSelected = false;
|
||||||
|
|
||||||
|
if (!players.Remove(player.Id))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
buttons.Add(player);
|
buttons.Add(player);
|
||||||
}
|
}
|
||||||
@@ -437,10 +441,12 @@ public sealed partial class AdminLogsControl : Control
|
|||||||
var button = new AdminLogPlayerButton(id)
|
var button = new AdminLogPlayerButton(id)
|
||||||
{
|
{
|
||||||
Text = name,
|
Text = name,
|
||||||
Pressed = true
|
Pressed = allSelected
|
||||||
};
|
};
|
||||||
|
|
||||||
SelectedPlayers.Add(id);
|
if (allSelected)
|
||||||
|
SelectedPlayers.Add(id);
|
||||||
|
|
||||||
button.OnPressed += PlayerButtonPressed;
|
button.OnPressed += PlayerButtonPressed;
|
||||||
|
|
||||||
buttons.Add(button);
|
buttons.Add(button);
|
||||||
|
|||||||
Reference in New Issue
Block a user