Next() private method

private Next ( bool enterChildren ) : bool
enterChildren bool
return bool
示例#1
0
        private void DrawProfilingData(ProfilerFrameDataIterator iter, Rect r, int threadIdx, float timeOffset, bool ghost)
        {
            float  num = (!ghost) ? 7f : 21f;
            string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
            bool   enterChildren        = true;
            Color  color        = GUI.color;
            Color  contentColor = GUI.contentColor;

            Color[] colors = ProfilerColors.colors;
            bool    flag   = false;
            float   x      = -1f;
            float   num2   = -1f;
            float   num3   = -1f;
            int     num4   = 0;
            float   num5   = -1f;
            string  text   = null;

            r.height -= 1f;
            GUI.BeginGroup(r);
            float num6 = 0f;

            r.y = num6;
            r.x = num6;
            bool  flag2     = Event.current.clickCount == 1 && Event.current.type == EventType.MouseDown;
            bool  flag3     = Event.current.clickCount == 2 && Event.current.type == EventType.MouseDown;
            Rect  shownArea = this.m_TimeArea.shownArea;
            float rectWidthDivShownWidth = r.width / shownArea.width;
            float x2 = r.x;
            float x3 = shownArea.x;

            while (iter.Next(enterChildren))
            {
                enterChildren = true;
                float num7       = iter.startTimeMS + timeOffset;
                float durationMS = iter.durationMS;
                float num8       = Mathf.Max(durationMS, 0.0003f);
                float num9       = ProfilerTimelineGUI.TimeToPixelCached(num7, rectWidthDivShownWidth, x3, x2);
                float num10      = ProfilerTimelineGUI.TimeToPixelCached(num7 + num8, rectWidthDivShownWidth, x3, x2) - 1f;
                float num11      = num10 - num9;
                if (num9 > r.x + r.width || num10 < r.x)
                {
                    enterChildren = false;
                }
                else
                {
                    float num12 = (float)(iter.depth - 1);
                    float num13 = r.y + num12 * 16f;
                    if (flag)
                    {
                        bool flag4 = false;
                        if (num11 >= num)
                        {
                            flag4 = true;
                        }
                        if (num3 != num13)
                        {
                            flag4 = true;
                        }
                        if (num9 - num2 > 6f)
                        {
                            flag4 = true;
                        }
                        if (flag4)
                        {
                            this.DrawSmallGroup(x, num2, num3, num4);
                            flag = false;
                        }
                    }
                    if (num11 < num)
                    {
                        enterChildren = false;
                        if (!flag)
                        {
                            flag = true;
                            num3 = num13;
                            x    = num9;
                            num4 = 0;
                        }
                        num2 = num10;
                        num4++;
                    }
                    else
                    {
                        int    id    = iter.id;
                        string path  = iter.path;
                        bool   flag5 = path == selectedPropertyPath && !ghost;
                        if (this.m_SelectedID >= 0)
                        {
                            flag5 &= (id == this.m_SelectedID);
                        }
                        flag5 &= (threadIdx == this.m_SelectedThread);
                        Color white  = Color.white;
                        Color color2 = colors[iter.group % colors.Length];
                        color2.a = ((!flag5) ? 0.75f : 1f);
                        if (ghost)
                        {
                            color2.a = 0.4f;
                            white.a  = 0.5f;
                        }
                        string text2 = iter.name;
                        if (flag5)
                        {
                            text = text2;
                            this.m_SelectedTime = num7;
                            this.m_SelectedDur  = durationMS;
                            num5 = num13 + 16f;
                        }
                        if (num11 < 20f)
                        {
                            text2 = string.Empty;
                        }
                        else
                        {
                            if (num11 < 50f && !flag5)
                            {
                                white.a *= (num11 - 20f) / 30f;
                            }
                            if (num11 > 200f)
                            {
                                text2 += string.Format(" ({0:f2}ms)", durationMS);
                            }
                        }
                        GUI.color        = color2;
                        GUI.contentColor = white;
                        Rect position = new Rect(num9, num13, num11, 14f);
                        GUI.Label(position, text2, ProfilerTimelineGUI.styles.bar);
                        if ((flag2 || flag3) && position.Contains(Event.current.mousePosition))
                        {
                            this.m_Window.SetSelectedPropertyPath(path);
                            this.m_SelectedThread = threadIdx;
                            this.m_SelectedID     = id;
                            UnityEngine.Object @object = EditorUtility.InstanceIDToObject(iter.instanceId);
                            if (@object is Component)
                            {
                                @object = ((Component)@object).gameObject;
                            }
                            if (@object != null)
                            {
                                if (flag2)
                                {
                                    EditorGUIUtility.PingObject(@object.GetInstanceID());
                                }
                                else
                                {
                                    if (flag3)
                                    {
                                        Selection.objects = new List <UnityEngine.Object>
                                        {
                                            @object
                                        }.ToArray();
                                    }
                                }
                            }
                            Event.current.Use();
                        }
                        flag = false;
                    }
                }
            }
            if (flag)
            {
                this.DrawSmallGroup(x, num2, num3, num4);
            }
            GUI.color        = color;
            GUI.contentColor = contentColor;
            if (text != null && threadIdx == this.m_SelectedThread)
            {
                string     text3   = string.Format(((double)this.m_SelectedDur < 1.0) ? "{0}\n{1:f3}ms" : "{0}\n{1:f2}ms", text, this.m_SelectedDur);
                GUIContent content = new GUIContent(text3);
                GUIStyle   tooltip = ProfilerTimelineGUI.styles.tooltip;
                Vector2    vector  = tooltip.CalcSize(content);
                float      num14   = this.m_TimeArea.TimeToPixel(this.m_SelectedTime + this.m_SelectedDur * 0.5f, r);
                if (num14 < r.x)
                {
                    num14 = r.x + 20f;
                }
                if (num14 > r.xMax)
                {
                    num14 = r.xMax - 20f;
                }
                Rect position2;
                if (num5 + 6f + vector.y < r.yMax)
                {
                    position2 = new Rect(num14 - 32f, num5, 50f, 7f);
                    GUI.Label(position2, GUIContent.none, ProfilerTimelineGUI.styles.tooltipArrow);
                }
                position2 = new Rect(num14, num5 + 6f, vector.x, vector.y);
                if (position2.xMax > r.xMax + 20f)
                {
                    position2.x = r.xMax - position2.width + 20f;
                }
                if (position2.yMax > r.yMax)
                {
                    position2.y = r.yMax - position2.height;
                }
                if (position2.y < r.y)
                {
                    position2.y = r.y;
                }
                GUI.Label(position2, content, tooltip);
            }
            if (Event.current.type == EventType.MouseDown && r.Contains(Event.current.mousePosition))
            {
                this.m_Window.ClearSelectedPropertyPath();
                this.m_SelectedID     = -1;
                this.m_SelectedThread = threadIdx;
                Event.current.Use();
            }
            GUI.EndGroup();
        }
 private void DrawProfilingData(ProfilerFrameDataIterator iter, Rect r, int threadIdx, float timeOffset, bool ghost, bool includeSubSamples)
 {
   float num1 = !ghost ? 7f : 21f;
   string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
   Color color1 = GUI.color;
   Color contentColor = GUI.contentColor;
   Color[] colors = ProfilerColors.colors;
   bool flag1 = false;
   float x1 = -1f;
   float x2 = -1f;
   float y1 = -1f;
   int size = 0;
   float y2 = -1f;
   string str = (string) null;
   float num2 = !includeSubSamples ? r.height : 16f;
   float num3 = !includeSubSamples ? 0.0f : 1f;
   float height = num2 - 2f * num3;
   r.height -= num3;
   GUI.BeginGroup(r);
   // ISSUE: explicit reference operation
   // ISSUE: variable of a reference type
   Rect& local = @r;
   float num4 = 0.0f;
   r.y = num4;
   double num5 = (double) num4;
   // ISSUE: explicit reference operation
   (^local).x = (float) num5;
   bool flag2 = Event.current.clickCount == 1 && Event.current.type == EventType.MouseDown;
   bool flag3 = Event.current.clickCount == 2 && Event.current.type == EventType.MouseDown;
   Rect shownArea = this.m_TimeArea.shownArea;
   float rectWidthDivShownWidth = r.width / shownArea.width;
   float x3 = r.x;
   float x4 = shownArea.x;
   bool enterChildren = true;
   while (iter.Next(enterChildren))
   {
     enterChildren = includeSubSamples;
     float time = iter.startTimeMS + timeOffset;
     float durationMs = iter.durationMS;
     float num6 = Mathf.Max(durationMs, 0.0003f);
     float pixelCached = ProfilerTimelineGUI.TimeToPixelCached(time, rectWidthDivShownWidth, x4, x3);
     float num7 = ProfilerTimelineGUI.TimeToPixelCached(time + num6, rectWidthDivShownWidth, x4, x3) - 1f;
     float width = num7 - pixelCached;
     if ((double) pixelCached > (double) r.x + (double) r.width || (double) num7 < (double) r.x)
     {
       enterChildren = false;
     }
     else
     {
       float num8 = (float) (iter.depth - 1);
       float y3 = r.y + num8 * num2;
       if (flag1)
       {
         bool flag4 = false;
         if ((double) width >= (double) num1)
           flag4 = true;
         if ((double) y1 != (double) y3)
           flag4 = true;
         if ((double) pixelCached - (double) x2 > 6.0)
           flag4 = true;
         if (flag4)
         {
           this.DrawSmallGroup(x1, x2, y1, height, size);
           flag1 = false;
         }
       }
       if ((double) width < (double) num1)
       {
         enterChildren = false;
         if (!flag1)
         {
           flag1 = true;
           y1 = y3;
           x1 = pixelCached;
           size = 0;
         }
         x2 = num7;
         ++size;
       }
       else
       {
         int id = iter.id;
         string path = iter.path;
         bool flag4 = path == selectedPropertyPath && !ghost;
         if (this.m_SelectedID >= 0)
           flag4 &= id == this.m_SelectedID;
         bool flag5 = flag4 & threadIdx == this.m_SelectedThread;
         Color white = Color.white;
         Color color2 = colors[iter.group % colors.Length];
         color2.a = !flag5 ? 0.75f : 1f;
         if (ghost)
         {
           color2.a = 0.4f;
           white.a = 0.5f;
         }
         string text = iter.name;
         if (flag5)
         {
           str = text;
           this.m_SelectedTime = time;
           this.m_SelectedDur = durationMs;
           y2 = y3 + num2;
         }
         if ((double) width < 20.0 || !includeSubSamples)
         {
           text = string.Empty;
         }
         else
         {
           if ((double) width < 50.0 && !flag5)
             white.a *= (float) (((double) width - 20.0) / 30.0);
           if ((double) width > 200.0)
             text += string.Format(" ({0:f2}ms)", (object) durationMs);
         }
         GUI.color = color2;
         GUI.contentColor = white;
         Rect position = new Rect(pixelCached, y3, width, height);
         GUI.Label(position, text, ProfilerTimelineGUI.styles.bar);
         if ((flag2 || flag3) && position.Contains(Event.current.mousePosition))
         {
           this.m_Window.SetSelectedPropertyPath(path);
           this.m_SelectedThread = threadIdx;
           this.m_SelectedID = id;
           UnityEngine.Object gameObject = EditorUtility.InstanceIDToObject(iter.instanceId);
           if (gameObject is Component)
             gameObject = (UnityEngine.Object) ((Component) gameObject).gameObject;
           if (gameObject != (UnityEngine.Object) null)
           {
             if (flag2)
               EditorGUIUtility.PingObject(gameObject.GetInstanceID());
             else if (flag3)
               Selection.objects = new List<UnityEngine.Object>()
               {
                 gameObject
               }.ToArray();
           }
           Event.current.Use();
         }
         flag1 = false;
       }
     }
   }
   if (flag1)
     this.DrawSmallGroup(x1, x2, y1, height, size);
   GUI.color = color1;
   GUI.contentColor = contentColor;
   if (str != null && threadIdx == this.m_SelectedThread && includeSubSamples)
   {
     GUIContent content = new GUIContent(string.Format((double) this.m_SelectedDur < 1.0 ? "{0}\n{1:f3}ms" : "{0}\n{1:f2}ms", (object) str, (object) this.m_SelectedDur));
     GUIStyle tooltip = ProfilerTimelineGUI.styles.tooltip;
     Vector2 vector2 = tooltip.CalcSize(content);
     float x5 = this.m_TimeArea.TimeToPixel(this.m_SelectedTime + this.m_SelectedDur * 0.5f, r);
     if ((double) x5 < (double) r.x)
       x5 = r.x + 20f;
     if ((double) x5 > (double) r.xMax)
       x5 = r.xMax - 20f;
     Rect position;
     if ((double) y2 + 6.0 + (double) vector2.y < (double) r.yMax)
     {
       position = new Rect(x5 - 32f, y2, 50f, 7f);
       GUI.Label(position, GUIContent.none, ProfilerTimelineGUI.styles.tooltipArrow);
     }
     position = new Rect(x5, y2 + 6f, vector2.x, vector2.y);
     if ((double) position.xMax > (double) r.xMax + 20.0)
       position.x = (float) ((double) r.xMax - (double) position.width + 20.0);
     if ((double) position.yMax > (double) r.yMax)
       position.y = r.yMax - position.height;
     if ((double) position.y < (double) r.y)
       position.y = r.y;
     GUI.Label(position, content, tooltip);
   }
   if (Event.current.type == EventType.MouseDown && r.Contains(Event.current.mousePosition))
   {
     this.m_Window.ClearSelectedPropertyPath();
     this.m_SelectedID = -1;
     this.m_SelectedThread = threadIdx;
     Event.current.Use();
   }
   GUI.EndGroup();
 }
示例#3
0
 private void DrawProfilingData(ProfilerFrameDataIterator iter, Rect r, int threadIdx, float timeOffset, bool ghost)
 {
     float num = !ghost ? 7f : 21f;
     string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
     bool enterChildren = true;
     Color color = GUI.color;
     Color contentColor = GUI.contentColor;
     Color[] colors = ProfilerColors.colors;
     bool flag2 = false;
     float num2 = -1f;
     float num3 = -1f;
     float y = -1f;
     int size = 0;
     float num6 = -1f;
     string str2 = null;
     r.height--;
     GUI.BeginGroup(r);
     float num20 = 0f;
     r.y = num20;
     r.x = num20;
     bool flag3 = (Event.current.clickCount == 1) && (Event.current.type == EventType.MouseDown);
     bool flag4 = (Event.current.clickCount == 2) && (Event.current.type == EventType.MouseDown);
     Rect shownArea = this.m_TimeArea.shownArea;
     float rectWidthDivShownWidth = r.width / shownArea.width;
     float x = r.x;
     float shownX = shownArea.x;
     while (iter.Next(enterChildren))
     {
         enterChildren = true;
         float time = iter.startTimeMS + timeOffset;
         float durationMS = iter.durationMS;
         float num12 = Mathf.Max(durationMS, 0.0003f);
         float num13 = TimeToPixelCached(time, rectWidthDivShownWidth, shownX, x);
         float num14 = TimeToPixelCached(time + num12, rectWidthDivShownWidth, shownX, x) - 1f;
         float width = num14 - num13;
         if ((num13 > (r.x + r.width)) || (num14 < r.x))
         {
             enterChildren = false;
         }
         else
         {
             float num16 = iter.depth - 1;
             float num17 = r.y + (num16 * 16f);
             if (flag2)
             {
                 bool flag5 = false;
                 if (width >= num)
                 {
                     flag5 = true;
                 }
                 if (y != num17)
                 {
                     flag5 = true;
                 }
                 if ((num13 - num3) > 6f)
                 {
                     flag5 = true;
                 }
                 if (flag5)
                 {
                     this.DrawSmallGroup(num2, num3, y, size);
                     flag2 = false;
                 }
             }
             if (width < num)
             {
                 enterChildren = false;
                 if (!flag2)
                 {
                     flag2 = true;
                     y = num17;
                     num2 = num13;
                     size = 0;
                 }
                 num3 = num14;
                 size++;
                 continue;
             }
             int id = iter.id;
             string path = iter.path;
             bool flag6 = (path == selectedPropertyPath) && !ghost;
             if (this.m_SelectedID >= 0)
             {
                 flag6 &= id == this.m_SelectedID;
             }
             flag6 &= threadIdx == this.m_SelectedThread;
             Color white = Color.white;
             Color color4 = colors[iter.group % colors.Length];
             color4.a = !flag6 ? 0.75f : 1f;
             if (ghost)
             {
                 color4.a = 0.4f;
                 white.a = 0.5f;
             }
             string name = iter.name;
             if (flag6)
             {
                 str2 = name;
                 this.m_SelectedTime = time;
                 this.m_SelectedDur = durationMS;
                 num6 = num17 + 16f;
             }
             if (width < 20f)
             {
                 name = string.Empty;
             }
             else
             {
                 if ((width < 50f) && !flag6)
                 {
                     white.a *= (width - 20f) / 30f;
                 }
                 if (width > 200f)
                 {
                     name = name + string.Format(" ({0:f2}ms)", durationMS);
                 }
             }
             GUI.color = color4;
             GUI.contentColor = white;
             Rect position = new Rect(num13, num17, width, 14f);
             GUI.Label(position, name, styles.bar);
             if ((flag3 || flag4) && position.Contains(Event.current.mousePosition))
             {
                 this.m_Window.SetSelectedPropertyPath(path);
                 this.m_SelectedThread = threadIdx;
                 this.m_SelectedID = id;
                 UnityEngine.Object gameObject = EditorUtility.InstanceIDToObject(iter.instanceId);
                 if (gameObject is Component)
                 {
                     gameObject = ((Component) gameObject).gameObject;
                 }
                 if (gameObject != null)
                 {
                     if (flag3)
                     {
                         EditorGUIUtility.PingObject(gameObject.GetInstanceID());
                     }
                     else if (flag4)
                     {
                         Selection.objects = new List<UnityEngine.Object> { gameObject }.ToArray();
                     }
                 }
                 Event.current.Use();
             }
             flag2 = false;
         }
     }
     if (flag2)
     {
         this.DrawSmallGroup(num2, num3, y, size);
     }
     GUI.color = color;
     GUI.contentColor = contentColor;
     if ((str2 != null) && (threadIdx == this.m_SelectedThread))
     {
         Rect rect3;
         GUIContent content = new GUIContent(string.Format((this.m_SelectedDur < 1.0) ? "{0}\n{1:f3}ms" : "{0}\n{1:f2}ms", str2, this.m_SelectedDur));
         GUIStyle tooltip = styles.tooltip;
         Vector2 vector = tooltip.CalcSize(content);
         float num19 = this.m_TimeArea.TimeToPixel(this.m_SelectedTime + (this.m_SelectedDur * 0.5f), r);
         if (num19 < r.x)
         {
             num19 = r.x + 20f;
         }
         if (num19 > r.xMax)
         {
             num19 = r.xMax - 20f;
         }
         if (((num6 + 6f) + vector.y) < r.yMax)
         {
             rect3 = new Rect(num19 - 32f, num6, 50f, 7f);
             GUI.Label(rect3, GUIContent.none, styles.tooltipArrow);
         }
         rect3 = new Rect(num19, num6 + 6f, vector.x, vector.y);
         if (rect3.xMax > (r.xMax + 20f))
         {
             rect3.x = (r.xMax - rect3.width) + 20f;
         }
         if (rect3.yMax > r.yMax)
         {
             rect3.y = r.yMax - rect3.height;
         }
         if (rect3.y < r.y)
         {
             rect3.y = r.y;
         }
         GUI.Label(rect3, content, tooltip);
     }
     if ((Event.current.type == EventType.MouseDown) && r.Contains(Event.current.mousePosition))
     {
         this.m_Window.ClearSelectedPropertyPath();
         this.m_SelectedID = -1;
         this.m_SelectedThread = threadIdx;
         Event.current.Use();
     }
     GUI.EndGroup();
 }
示例#4
0
        private void DrawProfilingData(ProfilerFrameDataIterator iter, Rect r, int threadIdx, float timeOffset, bool ghost, bool includeSubSamples)
        {
            float  num1 = !ghost ? 7f : 21f;
            string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
            Color  color1       = GUI.color;
            Color  contentColor = GUI.contentColor;

            Color[] colors = ProfilerColors.colors;
            bool    flag1  = false;
            float   x1     = -1f;
            float   x2     = -1f;
            float   y1     = -1f;
            int     size   = 0;
            float   y2     = -1f;
            string  str    = (string)null;
            float   num2   = !includeSubSamples ? r.height : 16f;
            float   num3   = !includeSubSamples ? 0.0f : 1f;
            float   height = num2 - 2f * num3;

            r.height -= num3;
            GUI.BeginGroup(r);
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            Rect& local = @r;
            float num4  = 0.0f;

            r.y = num4;
            double num5 = (double)num4;

            // ISSUE: explicit reference operation
            (^ local).x = (float)num5;
            bool  flag2     = Event.current.clickCount == 1 && Event.current.type == EventType.MouseDown;
            bool  flag3     = Event.current.clickCount == 2 && Event.current.type == EventType.MouseDown;
            Rect  shownArea = this.m_TimeArea.shownArea;
            float rectWidthDivShownWidth = r.width / shownArea.width;
            float x3            = r.x;
            float x4            = shownArea.x;
            bool  enterChildren = true;

            while (iter.Next(enterChildren))
            {
                enterChildren = includeSubSamples;
                float time        = iter.startTimeMS + timeOffset;
                float durationMs  = iter.durationMS;
                float num6        = Mathf.Max(durationMs, 0.0003f);
                float pixelCached = ProfilerTimelineGUI.TimeToPixelCached(time, rectWidthDivShownWidth, x4, x3);
                float num7        = ProfilerTimelineGUI.TimeToPixelCached(time + num6, rectWidthDivShownWidth, x4, x3) - 1f;
                float width       = num7 - pixelCached;
                if ((double)pixelCached > (double)r.x + (double)r.width || (double)num7 < (double)r.x)
                {
                    enterChildren = false;
                }
                else
                {
                    float num8 = (float)(iter.depth - 1);
                    float y3   = r.y + num8 * num2;
                    if (flag1)
                    {
                        bool flag4 = false;
                        if ((double)width >= (double)num1)
                        {
                            flag4 = true;
                        }
                        if ((double)y1 != (double)y3)
                        {
                            flag4 = true;
                        }
                        if ((double)pixelCached - (double)x2 > 6.0)
                        {
                            flag4 = true;
                        }
                        if (flag4)
                        {
                            this.DrawSmallGroup(x1, x2, y1, height, size);
                            flag1 = false;
                        }
                    }
                    if ((double)width < (double)num1)
                    {
                        enterChildren = false;
                        if (!flag1)
                        {
                            flag1 = true;
                            y1    = y3;
                            x1    = pixelCached;
                            size  = 0;
                        }
                        x2 = num7;
                        ++size;
                    }
                    else
                    {
                        int    id    = iter.id;
                        string path  = iter.path;
                        bool   flag4 = path == selectedPropertyPath && !ghost;
                        if (this.m_SelectedID >= 0)
                        {
                            flag4 &= id == this.m_SelectedID;
                        }
                        bool  flag5  = flag4 & threadIdx == this.m_SelectedThread;
                        Color white  = Color.white;
                        Color color2 = colors[iter.group % colors.Length];
                        color2.a = !flag5 ? 0.75f : 1f;
                        if (ghost)
                        {
                            color2.a = 0.4f;
                            white.a  = 0.5f;
                        }
                        string text = iter.name;
                        if (flag5)
                        {
                            str = text;
                            this.m_SelectedTime = time;
                            this.m_SelectedDur  = durationMs;
                            y2 = y3 + num2;
                        }
                        if ((double)width < 20.0 || !includeSubSamples)
                        {
                            text = string.Empty;
                        }
                        else
                        {
                            if ((double)width < 50.0 && !flag5)
                            {
                                white.a *= (float)(((double)width - 20.0) / 30.0);
                            }
                            if ((double)width > 200.0)
                            {
                                text += string.Format(" ({0:f2}ms)", (object)durationMs);
                            }
                        }
                        GUI.color        = color2;
                        GUI.contentColor = white;
                        Rect position = new Rect(pixelCached, y3, width, height);
                        GUI.Label(position, text, ProfilerTimelineGUI.styles.bar);
                        if ((flag2 || flag3) && position.Contains(Event.current.mousePosition))
                        {
                            this.m_Window.SetSelectedPropertyPath(path);
                            this.m_SelectedThread = threadIdx;
                            this.m_SelectedID     = id;
                            UnityEngine.Object gameObject = EditorUtility.InstanceIDToObject(iter.instanceId);
                            if (gameObject is Component)
                            {
                                gameObject = (UnityEngine.Object)((Component)gameObject).gameObject;
                            }
                            if (gameObject != (UnityEngine.Object)null)
                            {
                                if (flag2)
                                {
                                    EditorGUIUtility.PingObject(gameObject.GetInstanceID());
                                }
                                else if (flag3)
                                {
                                    Selection.objects = new List <UnityEngine.Object>()
                                    {
                                        gameObject
                                    }
                                }
		private void DrawProfilingData(ProfilerFrameDataIterator iter, Rect r, int threadIdx, float timeOffset, bool ghost)
		{
			float num = (!ghost) ? 7f : 21f;
			string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
			bool enterChildren = true;
			Color color = GUI.color;
			Color contentColor = GUI.contentColor;
			Color[] colors = ProfilerColors.colors;
			bool flag = false;
			float x = -1f;
			float num2 = -1f;
			float num3 = -1f;
			int num4 = 0;
			float num5 = -1f;
			string text = null;
			r.height -= 1f;
			GUI.BeginGroup(r);
			float num6 = 0f;
			r.y = num6;
			r.x = num6;
			bool flag2 = Event.current.clickCount == 1 && Event.current.type == EventType.MouseDown;
			bool flag3 = Event.current.clickCount == 2 && Event.current.type == EventType.MouseDown;
			Rect shownArea = this.m_TimeArea.shownArea;
			float rectWidthDivShownWidth = r.width / shownArea.width;
			float x2 = r.x;
			float x3 = shownArea.x;
			while (iter.Next(enterChildren))
			{
				enterChildren = true;
				float num7 = iter.startTimeMS + timeOffset;
				float durationMS = iter.durationMS;
				float num8 = Mathf.Max(durationMS, 0.0003f);
				float num9 = ProfilerTimelineGUI.TimeToPixelCached(num7, rectWidthDivShownWidth, x3, x2);
				float num10 = ProfilerTimelineGUI.TimeToPixelCached(num7 + num8, rectWidthDivShownWidth, x3, x2) - 1f;
				float num11 = num10 - num9;
				if (num9 > r.x + r.width || num10 < r.x)
				{
					enterChildren = false;
				}
				else
				{
					float num12 = (float)(iter.depth - 1);
					float num13 = r.y + num12 * 16f;
					if (flag)
					{
						bool flag4 = false;
						if (num11 >= num)
						{
							flag4 = true;
						}
						if (num3 != num13)
						{
							flag4 = true;
						}
						if (num9 - num2 > 6f)
						{
							flag4 = true;
						}
						if (flag4)
						{
							this.DrawSmallGroup(x, num2, num3, num4);
							flag = false;
						}
					}
					if (num11 < num)
					{
						enterChildren = false;
						if (!flag)
						{
							flag = true;
							num3 = num13;
							x = num9;
							num4 = 0;
						}
						num2 = num10;
						num4++;
					}
					else
					{
						int id = iter.id;
						string path = iter.path;
						bool flag5 = path == selectedPropertyPath && !ghost;
						if (this.m_SelectedID >= 0)
						{
							flag5 &= (id == this.m_SelectedID);
						}
						flag5 &= (threadIdx == this.m_SelectedThread);
						Color white = Color.white;
						Color color2 = colors[iter.group % colors.Length];
						color2.a = ((!flag5) ? 0.75f : 1f);
						if (ghost)
						{
							color2.a = 0.4f;
							white.a = 0.5f;
						}
						string text2 = iter.name;
						if (flag5)
						{
							text = text2;
							this.m_SelectedTime = num7;
							this.m_SelectedDur = durationMS;
							num5 = num13 + 16f;
						}
						if (num11 < 20f)
						{
							text2 = string.Empty;
						}
						else
						{
							if (num11 < 50f && !flag5)
							{
								white.a *= (num11 - 20f) / 30f;
							}
							if (num11 > 200f)
							{
								text2 += string.Format(" ({0:f2}ms)", durationMS);
							}
						}
						GUI.color = color2;
						GUI.contentColor = white;
						Rect position = new Rect(num9, num13, num11, 14f);
						GUI.Label(position, text2, ProfilerTimelineGUI.styles.bar);
						if ((flag2 || flag3) && position.Contains(Event.current.mousePosition))
						{
							this.m_Window.SetSelectedPropertyPath(path);
							this.m_SelectedThread = threadIdx;
							this.m_SelectedID = id;
							UnityEngine.Object @object = EditorUtility.InstanceIDToObject(iter.instanceId);
							if (@object is Component)
							{
								@object = ((Component)@object).gameObject;
							}
							if (@object != null)
							{
								if (flag2)
								{
									EditorGUIUtility.PingObject(@object.GetInstanceID());
								}
								else
								{
									if (flag3)
									{
										Selection.objects = new List<UnityEngine.Object>
										{
											@object
										}.ToArray();
									}
								}
							}
							Event.current.Use();
						}
						flag = false;
					}
				}
			}
			if (flag)
			{
				this.DrawSmallGroup(x, num2, num3, num4);
			}
			GUI.color = color;
			GUI.contentColor = contentColor;
			if (text != null && threadIdx == this.m_SelectedThread)
			{
				string text3 = string.Format(((double)this.m_SelectedDur < 1.0) ? "{0}\n{1:f3}ms" : "{0}\n{1:f2}ms", text, this.m_SelectedDur);
				GUIContent content = new GUIContent(text3);
				GUIStyle tooltip = ProfilerTimelineGUI.styles.tooltip;
				Vector2 vector = tooltip.CalcSize(content);
				float num14 = this.m_TimeArea.TimeToPixel(this.m_SelectedTime + this.m_SelectedDur * 0.5f, r);
				if (num14 < r.x)
				{
					num14 = r.x + 20f;
				}
				if (num14 > r.xMax)
				{
					num14 = r.xMax - 20f;
				}
				Rect position2;
				if (num5 + 6f + vector.y < r.yMax)
				{
					position2 = new Rect(num14 - 32f, num5, 50f, 7f);
					GUI.Label(position2, GUIContent.none, ProfilerTimelineGUI.styles.tooltipArrow);
				}
				position2 = new Rect(num14, num5 + 6f, vector.x, vector.y);
				if (position2.xMax > r.xMax + 20f)
				{
					position2.x = r.xMax - position2.width + 20f;
				}
				if (position2.yMax > r.yMax)
				{
					position2.y = r.yMax - position2.height;
				}
				if (position2.y < r.y)
				{
					position2.y = r.y;
				}
				GUI.Label(position2, content, tooltip);
			}
			if (Event.current.type == EventType.MouseDown && r.Contains(Event.current.mousePosition))
			{
				this.m_Window.ClearSelectedPropertyPath();
				this.m_SelectedID = -1;
				this.m_SelectedThread = threadIdx;
				Event.current.Use();
			}
			GUI.EndGroup();
		}
        private void DrawProfilingData(ProfilerFrameDataIterator iter, Rect r, int frameIndex, int threadIndex, float timeOffset, bool ghost, bool includeSubSamples)
        {
            float  num = (!ghost) ? 7f : 21f;
            string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
            Color  color        = GUI.color;
            Color  contentColor = GUI.contentColor;

            Color[] colors = ProfilerColors.colors;
            bool    flag   = false;
            float   x      = -1f;
            float   num2   = -1f;
            float   num3   = -1f;
            int     num4   = 0;
            float   num5   = (!includeSubSamples) ? r.height : 16f;
            float   num6   = (float)((!includeSubSamples) ? 0 : 1);
            float   height = num5 - 2f * num6;

            r.height -= num6;
            GUI.BeginGroup(r);
            float num7 = 0f;

            r.y = num7;
            r.x = num7;
            bool  flag2     = Event.current.clickCount == 1 && Event.current.type == EventType.MouseDown;
            bool  flag3     = Event.current.clickCount == 2 && Event.current.type == EventType.MouseDown;
            Rect  shownArea = this.m_TimeArea.shownArea;
            float rectWidthDivShownWidth = r.width / shownArea.width;
            float x2            = r.x;
            float x3            = shownArea.x;
            bool  enterChildren = true;

            while (iter.Next(enterChildren))
            {
                enterChildren = includeSubSamples;
                float num8       = iter.startTimeMS + timeOffset;
                float durationMS = iter.durationMS;
                float num9       = Mathf.Max(durationMS, 0.0003f);
                float num10      = ProfilerTimelineGUI.TimeToPixelCached(num8, rectWidthDivShownWidth, x3, x2);
                float num11      = ProfilerTimelineGUI.TimeToPixelCached(num8 + num9, rectWidthDivShownWidth, x3, x2) - 1f;
                float num12      = num11 - num10;
                if (num10 > r.x + r.width || num11 < r.x)
                {
                    enterChildren = false;
                }
                else
                {
                    float num13 = (float)(iter.depth - 1);
                    float num14 = r.y + num13 * num5;
                    if (flag)
                    {
                        bool flag4 = false;
                        if (num12 >= num)
                        {
                            flag4 = true;
                        }
                        if (num3 != num14)
                        {
                            flag4 = true;
                        }
                        if (num10 - num2 > 6f)
                        {
                            flag4 = true;
                        }
                        if (flag4)
                        {
                            this.DrawSmallGroup(x, num2, num3, height, num4);
                            flag = false;
                        }
                    }
                    if (num12 < num)
                    {
                        enterChildren = false;
                        if (!flag)
                        {
                            flag = true;
                            num3 = num14;
                            x    = num10;
                            num4 = 0;
                        }
                        num2 = num11;
                        num4++;
                    }
                    else
                    {
                        int    instanceId = iter.instanceId;
                        string path       = iter.path;
                        bool   flag5      = path == selectedPropertyPath && !ghost;
                        if (this.m_SelectedEntry.instanceId >= 0)
                        {
                            flag5 &= (instanceId == this.m_SelectedEntry.instanceId);
                        }
                        flag5 &= (threadIndex == this.m_SelectedEntry.threadId);
                        Color white  = Color.white;
                        Color color2 = colors[iter.group % colors.Length];
                        color2.a = ((!flag5) ? 0.75f : 1f);
                        if (ghost)
                        {
                            color2.a = 0.4f;
                            white.a  = 0.5f;
                        }
                        string text = iter.name;
                        if (num12 < 20f || !includeSubSamples)
                        {
                            text = string.Empty;
                        }
                        else
                        {
                            if (num12 < 50f && !flag5)
                            {
                                white.a *= (num12 - 20f) / 30f;
                            }
                            if (num12 > 200f)
                            {
                                text += string.Format(" ({0:f2}ms)", durationMS);
                            }
                        }
                        GUI.color        = color2;
                        GUI.contentColor = white;
                        Rect position = new Rect(num10, num14, num12, height);
                        GUI.Label(position, text, ProfilerTimelineGUI.styles.bar);
                        if ((flag2 || flag3) && position.Contains(Event.current.mousePosition) && includeSubSamples)
                        {
                            this.m_Window.SetSelectedPropertyPath(path);
                            this.m_SelectedEntry.Reset();
                            this.m_SelectedEntry.frameId    = frameIndex;
                            this.m_SelectedEntry.threadId   = threadIndex;
                            this.m_SelectedEntry.instanceId = instanceId;
                            this.m_SelectedEntry.name       = iter.name;
                            if (iter.extraTooltipInfo != null)
                            {
                                this.m_SelectedEntry.metaData = iter.extraTooltipInfo;
                            }
                            this.m_SelectedEntry.time         = num8;
                            this.m_SelectedEntry.duration     = durationMS;
                            this.m_SelectedEntry.relativeYPos = num14 + num5;
                            this.UpdateSelectedObject(flag2, flag3);
                            Event.current.Use();
                        }
                        flag = false;
                    }
                }
            }
            if (flag)
            {
                this.DrawSmallGroup(x, num2, num3, height, num4);
            }
            GUI.color        = color;
            GUI.contentColor = contentColor;
            if (Event.current.type == EventType.MouseDown && r.Contains(Event.current.mousePosition))
            {
                this.ClearSelection();
                Event.current.Use();
            }
            GUI.EndGroup();
        }