Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }