public ServerConsoleHandler(string title, GameManager gameManager) { this.gameManager = gameManager; cWindow = new Windows.ConsoleWindow(); cInput = new Windows.ConsoleInput(); cWindow.Initialize(); cWindow.SetTitle(title); cInput.OnInputText += Read; Application.logMessageReceived += HandleLog; }
public static void ThreadedLogRecieved(string condition, string stackTrace, LogType type) { if (input == null) { ServerConsole con = SingletonComponent <ServerConsole> .Instance; if (con == null) { return; } input = (Windows.ConsoleInput) SingletonComponent <ServerConsole> .Instance.GetFieldValue("input"); } if (!AlreadyLogged.Contains(condition)) { switch (type) { case LogType.Log: Console.ForegroundColor = ConsoleColor.Gray; break; case LogType.Warning: Console.ForegroundColor = ConsoleColor.Yellow; break; case LogType.Error: case LogType.Exception: case LogType.Assert: Console.ForegroundColor = ConsoleColor.Red; break; } input.ClearLine(input.statusText.Length); Console.WriteLine(condition); input.RedrawInputLine(); } else { AlreadyLogged.Remove(condition); } }
public static void ThreadedLogRecieved(string condition, string stackTrace, LogType type) { if (input == null) { ServerConsole con = SingletonComponent<ServerConsole>.Instance; if (con == null) return; input = (Windows.ConsoleInput)SingletonComponent<ServerConsole>.Instance.GetFieldValue("input"); } if (!AlreadyLogged.Contains(condition)) { switch (type) { case LogType.Log: Console.ForegroundColor = ConsoleColor.Gray; break; case LogType.Warning: Console.ForegroundColor = ConsoleColor.Yellow; break; case LogType.Error: case LogType.Exception: case LogType.Assert: Console.ForegroundColor = ConsoleColor.Red; break; } input.ClearLine(input.statusText.Length); Console.WriteLine(condition); input.RedrawInputLine(); } else { AlreadyLogged.Remove(condition); } }