Exemplo n.º 1
0
        private void consoleWindow(int windowID)
        {
            scrollPos = GUILayout.BeginScrollView(scrollPos);

            for (int i = 0; i < entries.Count; i++)
            {
                ConsoleMessage entry = entries[i];
                if (collapse && i > 0 && entry.message == entries[i - 1].message)
                {
                    continue;
                }

                switch (entry.type)
                {
                case LogType.Error:
                case LogType.Exception:
                    GUI.contentColor = Color.red;
                    break;

                case LogType.Warning:
                    GUI.contentColor = Color.yellow;
                    break;

                default:
                    GUI.contentColor = Color.white;
                    break;
                }

                if (entry.type == LogType.Exception || entry.type == LogType.Error)
                {
                    GUILayout.Label(entry.message + " || " + entry.stackTrace);
                }
                else
                {
                    GUILayout.Label(entry.message);
                }
            }

            GUILayout.EndScrollView();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearLabel))
            {
                entries.Clear();
            }

            collapse = GUILayout.Toggle(collapse, collapseLabel, GUILayout.ExpandWidth(false));
            GUILayout.EndHorizontal();

            GUI.DragWindow(new Rect(0, 0, 10000, 20));
        }
Exemplo n.º 2
0
        private void handleLog(string message, string stackTrace, LogType type)
        {
            ConsoleMessage entry = new ConsoleMessage(message, stackTrace, type);

            entries.Add(entry);
        }