UI/Chat/ChatEntry.cs
using Sandbox.UI;
using Sandbox.UI.Construct;
/// <summary>Individual chat message entry.</summary>
public sealed class ChatEntry : Panel
{
public string Name { get; set; }
public string Message { get; set; }
private RealTimeSince _timeSinceBorn;
protected override void OnAfterTreeRender( bool firstTime )
{
if ( !firstTime ) return;
Add.Label( Name, "name" ).Style.FontColor = Color.Cyan;
Add.Label( $": {Message}", "message" );
}
public override void Tick()
{
base.Tick();
if ( _timeSinceBorn > 10f )
Delete();
}
}