Пример #1
0
    /// <summary>
    /// Draws the main log panel
    /// </summary>
    public void DrawLogList()
    {
        LogListScrollPosition = GUILayout.BeginScrollView(LogListScrollPosition, GUILayout.Height(460));

        System.Text.RegularExpressions.Regex filterRegex = null;

        if (!String.IsNullOrEmpty(FilterRegex))
        {
            filterRegex = new System.Text.RegularExpressions.Regex(FilterRegex);
        }

        foreach (var log in memoryLog.ReverseLogs(SHOW_MAX_LINE_NUM).Reverse())
        {
            if (ShouldShowLog(filterRegex, log))
            {
                var oldTagColor = GUI.color;
                GUI.color = GetColor(log.tag);
                if (ShowTimes)
                {
                    GUILayout.Label(string.Format(Log.LOG_FORMAT, log.tag, log.time, log.msg), contentStyle, GUILayout.MaxWidth(420));
                }
                else
                {
                    GUILayout.Label(string.Format(Log.LOG_FORMAT_NOTIME, log.tag, log.msg), contentStyle, GUILayout.MaxWidth(420));
                }
                GUI.color = oldTagColor;
            }
        }
        GUILayout.EndScrollView();
    }