예제 #1
0
    public void DrawLogList()
    {
        Color backgroundColor = GUI.backgroundColor;

        this.LogListScrollPosition = GUILayout.BeginScrollView(this.LogListScrollPosition, Array.Empty <GUILayoutOption>());
        float height = this.WindowRect.height;
        float num    = 0f;
        float y      = this.LogLineStyle1.CalcSize(new GUIContent("Test")).y;
        Regex regex  = null;

        if (!string.IsNullOrEmpty(this.FilterRegex))
        {
            regex = new Regex(this.FilterRegex);
        }
        int      num2  = 0;
        GUIStyle style = this.LogLineStyle1;

        for (int i = 0; i < this.LogInfo.Count; i++)
        {
            LogInfo logInfo = this.LogInfo[i];
            if (this.ShouldShowLog(regex, logInfo))
            {
                num2++;
                if (num + y > this.LogListScrollPosition.y && num < this.LogListScrollPosition.y + height)
                {
                    if (i == this.SelectedMessage)
                    {
                        style = this.SelectedLogLineStyle;
                    }
                    else
                    {
                        style = ((num2 % 2 == 0) ? this.LogLineStyle1 : this.LogLineStyle2);
                    }
                    string text = logInfo.Message;
                    text = text.Replace(UberLogger.Logger.UnityInternalNewLine, " ");
                    if (this.ShowTimes)
                    {
                        text = logInfo.GetRelativeTimeStampAsString() + ": " + text;
                    }
                    if (GUILayout.Button(new GUIContent(text, this.GetIconForLog(logInfo)), style, new GUILayoutOption[]
                    {
                        GUILayout.Height(y)
                    }))
                    {
                        if (i == this.SelectedMessage)
                        {
                            if ((double)Time.realtimeSinceStartup - this.LastMessageClickTime < 0.30000001192092896)
                            {
                                this.LastMessageClickTime = 0.0;
                            }
                            else
                            {
                                this.LastMessageClickTime = (double)Time.realtimeSinceStartup;
                            }
                        }
                        else
                        {
                            this.SelectedMessage        = i;
                            this.SelectedCallstackFrame = -1;
                        }
                    }
                }
                else
                {
                    GUILayout.Space(y);
                }
                num += y;
            }
        }
        GUILayout.EndScrollView();
        GUI.backgroundColor = backgroundColor;
    }