@using System.Collections.Generic
@using System.Linq
@using Sandbox;
@using Sandbox.UI;
@namespace MurderGame
@inherits Panel
@code
{
Dictionary Entries = new();
public Panel List { get; set; }
public static TabListOverlay Instance { get; private set; }
public TabListOverlay()
{
Instance = this;
}
public bool IsOpen => Input.Down( "score" );
public override void Tick()
{
base.Tick();
SetClass( "hidden", !IsOpen );
if ( !IsVisible )
return;
foreach ( IClient cl in Game.Clients.Except( Entries.Keys ) )
{
TabListEntry entry = new();
Entries.Add(cl, entry);
entry.UpdateFrom(cl);
entry.Parent = List;
}
foreach ( IClient cl in Entries.Keys.Except( Game.Clients ) )
{
if( Entries.TryGetValue( cl, out var entry ) )
{
entry.Delete();
Entries.Remove( cl );
}
}
// foreach ( var entry in Entries )
// {
// entry.Value.Parent = List;
// }
}
}