public DebugTextDisplayLine AddLineFromAsync(Func <string> text, Color background, Color foreground) { var l = new DebugTextDisplayLine(text); l.SetColor(foreground); l.SetBackground(background); return(AddLineFromAsync(l)); }
public DebugTextDisplayLine AddLine(string text, Color background, Color foreground) { var l = new DebugTextDisplayLine(() => text); l.SetColor(foreground); l.SetBackground(background); return(AddLine(l)); }
private static DebugTextDisplayLine CreateLine(SAMLogEntry e) { DebugTextDisplayLine line; switch (e.Level) { case SAMLogLevel.FATAL_ERROR: line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}"); line.SetBackground(Color.Red); line.SetColor(Color.Black); return(line); case SAMLogLevel.ERROR: line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}"); line.SetBackground(Color.Red * 0.6f); line.SetColor(Color.Black); return(line); case SAMLogLevel.WARNING: line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}"); line.SetBackground(Color.DarkOrange * 0.6f); line.SetColor(Color.Black); line.SetLifetime(60); return(line); case SAMLogLevel.INFORMATION: line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}"); line.SetBackground(Color.DodgerBlue * 0.5f); line.SetColor(Color.Black); line.SetLifetime(30); return(line); case SAMLogLevel.DEBUG: line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}"); line.SetBackground(Color.GreenYellow * 0.5f); line.SetColor(Color.Black); line.SetLifetime(5); line.SetSpawntime(0.5f); line.SetDecaytime(2); return(line); default: throw new ArgumentOutOfRangeException(); } }