From 87d74b50bf443bf199be05bd03afdca6ece082ff Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Wed, 2 Aug 2023 17:36:42 +0100 Subject: Add temporary tablist --- code/ui/overlay/TabListOverlay.razor | 142 +++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 code/ui/overlay/TabListOverlay.razor (limited to 'code/ui/overlay/TabListOverlay.razor') diff --git a/code/ui/overlay/TabListOverlay.razor b/code/ui/overlay/TabListOverlay.razor new file mode 100644 index 0000000..d240c9e --- /dev/null +++ b/code/ui/overlay/TabListOverlay.razor @@ -0,0 +1,142 @@ + + +@using System.Collections.Generic +@using System.Linq +@using Sandbox; +@using Sandbox.UI; + +@namespace MurderGame +@inherits Panel + + + +
+
+ Murder + This game mode is still a work in progress. Source code available at https://github.com/LMBishop/murder. +
+ +
+
+ Name + Ping +
+ +
+ +
+
+
+ +@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; + // } + } + +} \ No newline at end of file -- cgit v1.2.3-70-g09d2