mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-19 22:08:34 -04:00
46 lines
960 B
Plaintext
46 lines
960 B
Plaintext
@using Sandbox
|
|
@using Sandbox.UI
|
|
@namespace Sandbox.UI.Dev
|
|
@inherits Panel
|
|
|
|
<root class="@classes">
|
|
<div class="time">@Event.Time.ToString("hh:mm:ss")</div>
|
|
<div class="message">@Event.Message</div>
|
|
</root>
|
|
|
|
|
|
@code
|
|
{
|
|
static ConsoleRow selectedLine;
|
|
|
|
public LogEvent Event;
|
|
|
|
public bool AutoDelete;
|
|
public RealTimeUntil TimeUntilDelete;
|
|
|
|
public Action<LogEvent> OnEntryClicked;
|
|
|
|
public string classes => $"consolerow {(selectedLine==this?"highlight":"")} {Event.Level.ToString()}";
|
|
|
|
internal void SetLogEvent(LogEvent e)
|
|
{
|
|
Event = e;
|
|
StateHasChanged();
|
|
}
|
|
|
|
protected override void OnClick(MousePanelEvent e)
|
|
{
|
|
OnEntryClicked?.Invoke(Event);
|
|
selectedLine = this;
|
|
}
|
|
|
|
protected override void OnMouseDown(MousePanelEvent e)
|
|
{
|
|
base.OnMouseDown(e);
|
|
|
|
e.StopPropagation();
|
|
}
|
|
|
|
protected override int BuildHash() => HashCode.Combine( selectedLine );
|
|
}
|