GetColumn() private method

private GetColumn ( ProfilerColumn column ) : string
column ProfilerColumn
return string
Ejemplo n.º 1
0
        public static GPUElement Create(UnityEditorInternal.ProfilerProperty root)
        {
            allGPUEle = new List <GPUElement>();
            if (allGPUEle == null)
            {
                return(null);
            }
            if (root == null)
            {
                return(null);
            }
            GPUElement rootEle = new GPUElement
            {
                FuncName        = root.propertyName,
                TotalGPUPercent = root.GetColumn(ProfilerColumn.TotalGPUPercent),
                SelfGPUPercent  = root.GetColumn(ProfilerColumn.SelfGPUPercent),
                DrawCalls       = root.GetColumn(ProfilerColumn.DrawCalls),
                TotalGPUTime    = root.GetColumn(ProfilerColumn.TotalGPUTime),
                SelfGPUTime     = root.GetColumn(ProfilerColumn.SelfGPUTime),
                RelatedObjName  = root.GetColumn(ProfilerColumn.ObjectName),
                Depth           = root.depth
            };

            if (allGPUEle != null)
            {
                allGPUEle.Add(rootEle);
            }

            while (root.Next(root.HasChildren))
            {
                GPUElement ele = new GPUElement
                {
                    FuncName        = root.propertyName,
                    TotalGPUPercent = root.GetColumn(ProfilerColumn.TotalGPUPercent),
                    DrawCalls       = root.GetColumn(ProfilerColumn.DrawCalls),
                    TotalGPUTime    = root.GetColumn(ProfilerColumn.TotalGPUTime),
                    RelatedObjName  = root.GetColumn(ProfilerColumn.ObjectName),
                    Depth           = root.depth
                };
                if (allGPUEle != null)
                {
                    allGPUEle.Add(ele);
                }
            }

            SetChildren();
            return(rootEle);
        }
Ejemplo n.º 2
0
            private void IterateProfilingData(ProfilerProperty property, ProfilerColumn[] columns, string searchString)
            {
                this.m_NumResultsUsed      = 0;
                this.m_ColumnsToShow       = columns;
                this.m_FoundAllResults     = true;
                this.m_SelectedSearchIndex = -1;
                int    num = 0;
                string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;

                while (property.Next(true))
                {
                    if (num >= this.m_SearchResults.Length)
                    {
                        this.m_FoundAllResults = false;
                        break;
                    }
                    string propertyPath = property.propertyPath;
                    int    startIndex   = Mathf.Max(propertyPath.LastIndexOf('/'), 0);
                    if (propertyPath.IndexOf(searchString, startIndex, StringComparison.CurrentCultureIgnoreCase) > -1)
                    {
                        string[] array = new string[this.m_ColumnsToShow.Length];
                        for (int i = 0; i < this.m_ColumnsToShow.Length; i++)
                        {
                            array[i] = property.GetColumn(this.m_ColumnsToShow[i]);
                        }
                        this.m_SearchResults[num].propertyPath = propertyPath;
                        this.m_SearchResults[num].columnValues = array;
                        if (propertyPath == selectedPropertyPath)
                        {
                            this.m_SelectedSearchIndex = num;
                        }
                        num++;
                    }
                }
                this.m_NumResultsUsed = num;
            }
Ejemplo n.º 3
0
        private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
        {
            bool     flag               = false;
            Event    current            = Event.current;
            Rect     rowRect            = this.GetRowRect(rowCount);
            Rect     position           = rowRect;
            GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);

            if (current.type == EventType.Repaint)
            {
                rowBackgroundStyle.Draw(position, GUIContent.none, false, false, selected, false);
            }
            float num = (float)property.depth * 16f + 4f;

            if (property.HasChildren)
            {
                flag        = this.IsExpanded(property.propertyPath);
                GUI.changed = false;
                num        -= 14f;
                Rect position2 = new Rect(num, position.y, 14f, 16f);
                flag = GUI.Toggle(position2, flag, GUIContent.none, ProfilerHierarchyGUI.styles.foldout);
                if (GUI.changed)
                {
                    this.SetExpanded(property, flag);
                }
                num += 16f;
            }
            if (current.type == EventType.Repaint)
            {
                this.DrawTextColumn(ref position, property.GetColumn(this.m_ColumnsToShow[0]), 0, (this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName) ? 4f : num, selected);
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
                int num2 = 1;
                for (int i = 1; i < this.m_VisibleColumns.Length; i++)
                {
                    if (this.ColIsVisible(i))
                    {
                        position.x    += (float)this.m_Splitter.realSizes[num2 - 1];
                        position.width = (float)this.m_Splitter.realSizes[num2] - 4f;
                        num2++;
                        ProfilerHierarchyGUI.styles.numberLabel.Draw(position, property.GetColumn(this.m_ColumnsToShow[i]), false, false, false, selected);
                    }
                }
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
            }
            if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
            {
                GUIUtility.hotControl = 0;
                if (!EditorGUI.actionKey)
                {
                    if (this.m_DetailPane)
                    {
                        if (current.clickCount == 1 && property.instanceIDs.Length > 0)
                        {
                            string text = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                            if (this.m_DetailViewSelectedProperty != text)
                            {
                                this.m_DetailViewSelectedProperty = text;
                                UnityEngine.Object @object = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
                                if (@object is Component)
                                {
                                    @object = ((Component)@object).gameObject;
                                }
                                if (@object != null)
                                {
                                    EditorGUIUtility.PingObject(@object.GetInstanceID());
                                }
                            }
                            else
                            {
                                this.m_DetailViewSelectedProperty = string.Empty;
                            }
                        }
                        else
                        {
                            if (current.clickCount == 2)
                            {
                                ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
                                this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                            }
                        }
                    }
                    else
                    {
                        this.RowMouseDown(property.propertyPath);
                    }
                    this.DoScroll();
                }
                else
                {
                    if (!this.m_DetailPane)
                    {
                        this.m_Window.ClearSelectedPropertyPath();
                    }
                    else
                    {
                        this.m_DetailViewSelectedProperty = string.Empty;
                    }
                }
                GUIUtility.keyboardControl = id;
                current.Use();
            }
            if (selected && GUIUtility.keyboardControl == id && current.type == EventType.KeyDown && (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter))
            {
                ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
            }
            return(flag);
        }
			private void IterateProfilingData(ProfilerProperty property, ProfilerColumn[] columns, string searchString)
			{
				this.m_NumResultsUsed = 0;
				this.m_ColumnsToShow = columns;
				this.m_FoundAllResults = true;
				this.m_SelectedSearchIndex = -1;
				int num = 0;
				string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
				while (property.Next(true))
				{
					if (num >= this.m_SearchResults.Length)
					{
						this.m_FoundAllResults = false;
						break;
					}
					string propertyPath = property.propertyPath;
					int startIndex = Mathf.Max(propertyPath.LastIndexOf('/'), 0);
					if (propertyPath.IndexOf(searchString, startIndex, StringComparison.CurrentCultureIgnoreCase) > -1)
					{
						string[] array = new string[this.m_ColumnsToShow.Length];
						for (int i = 0; i < this.m_ColumnsToShow.Length; i++)
						{
							array[i] = property.GetColumn(this.m_ColumnsToShow[i]);
						}
						this.m_SearchResults[num].propertyPath = propertyPath;
						this.m_SearchResults[num].columnValues = array;
						if (propertyPath == selectedPropertyPath)
						{
							this.m_SelectedSearchIndex = num;
						}
						num++;
					}
				}
				this.m_NumResultsUsed = num;
			}
		private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
		{
			bool flag = false;
			Event current = Event.current;
			Rect rowRect = this.GetRowRect(rowCount);
			Rect position = rowRect;
			GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);
			if (current.type == EventType.Repaint)
			{
				rowBackgroundStyle.Draw(position, GUIContent.none, false, false, selected, false);
			}
			float num = (float)property.depth * 16f + 4f;
			if (property.HasChildren)
			{
				flag = this.IsExpanded(property.propertyPath);
				GUI.changed = false;
				num -= 14f;
				Rect position2 = new Rect(num, position.y, 14f, 16f);
				flag = GUI.Toggle(position2, flag, GUIContent.none, ProfilerHierarchyGUI.styles.foldout);
				if (GUI.changed)
				{
					this.SetExpanded(property, flag);
				}
				num += 16f;
			}
			if (current.type == EventType.Repaint)
			{
				this.DrawTextColumn(ref position, property.GetColumn(this.m_ColumnsToShow[0]), 0, (this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName) ? 4f : num, selected);
				ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
				int num2 = 1;
				for (int i = 1; i < this.m_VisibleColumns.Length; i++)
				{
					if (this.ColIsVisible(i))
					{
						position.x += (float)this.m_Splitter.realSizes[num2 - 1];
						position.width = (float)this.m_Splitter.realSizes[num2] - 4f;
						num2++;
						ProfilerHierarchyGUI.styles.numberLabel.Draw(position, property.GetColumn(this.m_ColumnsToShow[i]), false, false, false, selected);
					}
				}
				ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
			}
			if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
			{
				GUIUtility.hotControl = 0;
				if (!EditorGUI.actionKey)
				{
					if (this.m_DetailPane)
					{
						if (current.clickCount == 1 && property.instanceIDs.Length > 0)
						{
							string text = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
							if (this.m_DetailViewSelectedProperty != text)
							{
								this.m_DetailViewSelectedProperty = text;
								UnityEngine.Object @object = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
								if (@object is Component)
								{
									@object = ((Component)@object).gameObject;
								}
								if (@object != null)
								{
									EditorGUIUtility.PingObject(@object.GetInstanceID());
								}
							}
							else
							{
								this.m_DetailViewSelectedProperty = string.Empty;
							}
						}
						else
						{
							if (current.clickCount == 2)
							{
								ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
								this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
							}
						}
					}
					else
					{
						this.RowMouseDown(property.propertyPath);
					}
					this.DoScroll();
				}
				else
				{
					if (!this.m_DetailPane)
					{
						this.m_Window.ClearSelectedPropertyPath();
					}
					else
					{
						this.m_DetailViewSelectedProperty = string.Empty;
					}
				}
				GUIUtility.keyboardControl = id;
				current.Use();
			}
			if (selected && GUIUtility.keyboardControl == id && current.type == EventType.KeyDown && (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter))
			{
				ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
			}
			return flag;
		}
Ejemplo n.º 6
0
 private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
 {
     bool flag = false;
     Event current = Event.current;
     Rect rowRect = this.GetRowRect(rowCount);
     Rect position = rowRect;
     GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);
     if (current.type == EventType.Repaint)
     {
         rowBackgroundStyle.Draw(position, GUIContent.none, false, false, selected, false);
     }
     float x = (property.depth * 16f) + 4f;
     if (property.HasChildren)
     {
         flag = this.IsExpanded(property.propertyPath);
         GUI.changed = false;
         x -= 14f;
         Rect rect3 = new Rect(x, position.y, 14f, 16f);
         flag = GUI.Toggle(rect3, flag, GUIContent.none, styles.foldout);
         if (GUI.changed)
         {
             this.SetExpanded(property, flag);
         }
         x += 16f;
     }
     string column = property.GetColumn(this.m_ColumnsToShow[0]);
     if (current.type == EventType.Repaint)
     {
         this.DrawTextColumn(ref position, column, 0, (this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName) ? 4f : x, selected);
     }
     if (ProfilerInstrumentationPopup.InstrumentationEnabled && ProfilerInstrumentationPopup.FunctionHasInstrumentationPopup(column))
     {
         float num2 = ((position.x + x) + 5f) + styles.numberLabel.CalcSize(new GUIContent(column)).x;
         num2 = Mathf.Clamp(num2, 0f, (this.m_Splitter.realSizes[0] - 30f) + 2f);
         Rect rect4 = new Rect(num2, position.y, 30f, 16f);
         if (GUI.Button(rect4, styles.instrumentationIcon, styles.miniPullDown))
         {
             ProfilerInstrumentationPopup.Show(rect4, column);
         }
     }
     if (current.type == EventType.Repaint)
     {
         styles.numberLabel.alignment = TextAnchor.MiddleRight;
         int index = 1;
         for (int i = 1; i < this.m_VisibleColumns.Length; i++)
         {
             if (this.ColIsVisible(i))
             {
                 position.x += this.m_Splitter.realSizes[index - 1];
                 position.width = this.m_Splitter.realSizes[index] - 4f;
                 index++;
                 styles.numberLabel.Draw(position, property.GetColumn(this.m_ColumnsToShow[i]), false, false, false, selected);
             }
         }
         styles.numberLabel.alignment = TextAnchor.MiddleLeft;
     }
     if ((current.type == EventType.MouseDown) && rowRect.Contains(current.mousePosition))
     {
         GUIUtility.hotControl = 0;
         if (!EditorGUI.actionKey)
         {
             if (this.m_DetailPane)
             {
                 if ((current.clickCount == 1) && (property.instanceIDs.Length > 0))
                 {
                     string str2 = DetailViewSelectedPropertyPath(property);
                     if (this.m_DetailViewSelectedProperty != str2)
                     {
                         this.m_DetailViewSelectedProperty = str2;
                         UnityEngine.Object gameObject = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
                         if (gameObject is Component)
                         {
                             gameObject = ((Component) gameObject).gameObject;
                         }
                         if (gameObject != null)
                         {
                             EditorGUIUtility.PingObject(gameObject.GetInstanceID());
                         }
                     }
                     else
                     {
                         this.m_DetailViewSelectedProperty = string.Empty;
                     }
                 }
                 else if (current.clickCount == 2)
                 {
                     SelectObjectsInHierarchyView(property);
                     this.m_DetailViewSelectedProperty = DetailViewSelectedPropertyPath(property);
                 }
             }
             else
             {
                 this.RowMouseDown(property.propertyPath);
             }
             this.DoScroll();
         }
         else if (!this.m_DetailPane)
         {
             this.m_Window.ClearSelectedPropertyPath();
         }
         else
         {
             this.m_DetailViewSelectedProperty = string.Empty;
         }
         GUIUtility.keyboardControl = id;
         current.Use();
     }
     if (((selected && (GUIUtility.keyboardControl == id)) && (current.type == EventType.KeyDown)) && ((current.keyCode == KeyCode.Return) || (current.keyCode == KeyCode.KeypadEnter)))
     {
         SelectObjectsInHierarchyView(property);
     }
     return flag;
 }
        private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
        {
            bool     expanded           = false;
            Event    current            = Event.current;
            Rect     rowRect            = this.GetRowRect(rowCount);
            Rect     currentRect        = rowRect;
            GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);

            if (current.type == EventType.Repaint)
            {
                rowBackgroundStyle.Draw(currentRect, GUIContent.none, false, false, selected, false);
            }
            float num = (float)((double)property.depth * 16.0 + 4.0);

            if (property.HasChildren)
            {
                bool flag = this.IsExpanded(property.propertyPath);
                GUI.changed = false;
                float x = num - 14f;
                expanded = GUI.Toggle(new Rect(x, currentRect.y, 14f, 16f), flag, GUIContent.none, ProfilerHierarchyGUI.styles.foldout);
                if (GUI.changed)
                {
                    this.SetExpanded(property, expanded);
                }
                num = x + 16f;
            }
            string column = property.GetColumn(this.m_ColumnsToShow[0]);

            if (current.type == EventType.Repaint)
            {
                this.DrawTextColumn(ref currentRect, column, 0, this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName ? 4f : num, selected);
            }
            if (ProfilerInstrumentationPopup.InstrumentationEnabled && ProfilerInstrumentationPopup.FunctionHasInstrumentationPopup(column))
            {
                Rect rect = new Rect(Mathf.Clamp((float)((double)currentRect.x + (double)num + 5.0) + ProfilerHierarchyGUI.styles.numberLabel.CalcSize(new GUIContent(column)).x, 0.0f, (float)((double)this.m_Splitter.realSizes[0] - 30.0 + 2.0)), currentRect.y, 30f, 16f);
                if (GUI.Button(rect, ProfilerHierarchyGUI.styles.instrumentationIcon, ProfilerHierarchyGUI.styles.miniPullDown))
                {
                    ProfilerInstrumentationPopup.Show(rect, column);
                }
            }
            if (current.type == EventType.Repaint)
            {
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
                int index1 = 1;
                for (int index2 = 1; index2 < this.m_VisibleColumns.Length; ++index2)
                {
                    if (this.ColIsVisible(index2))
                    {
                        currentRect.x    += (float)this.m_Splitter.realSizes[index1 - 1];
                        currentRect.width = (float)this.m_Splitter.realSizes[index1] - 4f;
                        ++index1;
                        ProfilerHierarchyGUI.styles.numberLabel.Draw(currentRect, property.GetColumn(this.m_ColumnsToShow[index2]), false, false, false, selected);
                    }
                }
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
            }
            if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
            {
                GUIUtility.hotControl = 0;
                if (!EditorGUI.actionKey)
                {
                    if (this.m_DetailPane)
                    {
                        if (current.clickCount == 1 && property.instanceIDs.Length > 0)
                        {
                            string str = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                            if (this.m_DetailViewSelectedProperty != str)
                            {
                                this.m_DetailViewSelectedProperty = str;
                                UnityEngine.Object gameObject = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
                                if (gameObject is Component)
                                {
                                    gameObject = (UnityEngine.Object)((Component)gameObject).gameObject;
                                }
                                if (gameObject != (UnityEngine.Object)null)
                                {
                                    EditorGUIUtility.PingObject(gameObject.GetInstanceID());
                                }
                            }
                            else
                            {
                                this.m_DetailViewSelectedProperty = string.Empty;
                            }
                        }
                        else if (current.clickCount == 2)
                        {
                            ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
                            this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                        }
                    }
                    else
                    {
                        this.RowMouseDown(property.propertyPath);
                    }
                    this.DoScroll();
                }
                else if (!this.m_DetailPane)
                {
                    this.m_Window.ClearSelectedPropertyPath();
                }
                else
                {
                    this.m_DetailViewSelectedProperty = string.Empty;
                }
                GUIUtility.keyboardControl = id;
                current.Use();
            }
            if (selected && GUIUtility.keyboardControl == id && current.type == EventType.KeyDown && (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter))
            {
                ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
            }
            return(expanded);
        }
Ejemplo n.º 8
0
        private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
        {
            bool     flag               = false;
            Event    current            = Event.current;
            Rect     rowRect            = this.GetRowRect(rowCount);
            Rect     position           = rowRect;
            GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);

            if (current.type == EventType.Repaint)
            {
                rowBackgroundStyle.Draw(position, GUIContent.none, false, false, selected, false);
            }
            float x = (property.depth * 16f) + 4f;

            if (property.HasChildren)
            {
                flag        = this.IsExpanded(property.propertyPath);
                GUI.changed = false;
                x          -= 14f;
                Rect rect3 = new Rect(x, position.y, 14f, 16f);
                flag = GUI.Toggle(rect3, flag, GUIContent.none, styles.foldout);
                if (GUI.changed)
                {
                    this.SetExpanded(property, flag);
                }
                x += 16f;
            }
            string column = property.GetColumn(this.m_ColumnsToShow[0]);

            if (current.type == EventType.Repaint)
            {
                this.DrawTextColumn(ref position, column, 0, (this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName) ? 4f : x, selected);
            }
            if (ProfilerInstrumentationPopup.InstrumentationEnabled && ProfilerInstrumentationPopup.FunctionHasInstrumentationPopup(column))
            {
                float num2 = ((position.x + x) + 5f) + styles.numberLabel.CalcSize(new GUIContent(column)).x;
                num2 = Mathf.Clamp(num2, 0f, (this.m_Splitter.realSizes[0] - 30f) + 2f);
                Rect rect4 = new Rect(num2, position.y, 30f, 16f);
                if (GUI.Button(rect4, styles.instrumentationIcon, styles.miniPullDown))
                {
                    ProfilerInstrumentationPopup.Show(rect4, column);
                }
            }
            if (current.type == EventType.Repaint)
            {
                styles.numberLabel.alignment = TextAnchor.MiddleRight;
                int index = 1;
                for (int i = 1; i < this.m_VisibleColumns.Length; i++)
                {
                    if (this.ColIsVisible(i))
                    {
                        position.x    += this.m_Splitter.realSizes[index - 1];
                        position.width = this.m_Splitter.realSizes[index] - 4f;
                        index++;
                        styles.numberLabel.Draw(position, property.GetColumn(this.m_ColumnsToShow[i]), false, false, false, selected);
                    }
                }
                styles.numberLabel.alignment = TextAnchor.MiddleLeft;
            }
            if ((current.type == EventType.MouseDown) && rowRect.Contains(current.mousePosition))
            {
                GUIUtility.hotControl = 0;
                if (!EditorGUI.actionKey)
                {
                    if (this.m_DetailPane)
                    {
                        if ((current.clickCount == 1) && (property.instanceIDs.Length > 0))
                        {
                            string str2 = DetailViewSelectedPropertyPath(property);
                            if (this.m_DetailViewSelectedProperty != str2)
                            {
                                this.m_DetailViewSelectedProperty = str2;
                                Object gameObject = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
                                if (gameObject is Component)
                                {
                                    gameObject = ((Component)gameObject).gameObject;
                                }
                                if (gameObject != null)
                                {
                                    EditorGUIUtility.PingObject(gameObject.GetInstanceID());
                                }
                            }
                            else
                            {
                                this.m_DetailViewSelectedProperty = string.Empty;
                            }
                        }
                        else if (current.clickCount == 2)
                        {
                            SelectObjectsInHierarchyView(property);
                            this.m_DetailViewSelectedProperty = DetailViewSelectedPropertyPath(property);
                        }
                    }
                    else
                    {
                        this.RowMouseDown(property.propertyPath);
                    }
                    this.DoScroll();
                }
                else if (!this.m_DetailPane)
                {
                    this.m_Window.ClearSelectedPropertyPath();
                }
                else
                {
                    this.m_DetailViewSelectedProperty = string.Empty;
                }
                GUIUtility.keyboardControl = id;
                current.Use();
            }
            if (((selected && (GUIUtility.keyboardControl == id)) && (current.type == EventType.KeyDown)) && ((current.keyCode == KeyCode.Return) || (current.keyCode == KeyCode.KeypadEnter)))
            {
                SelectObjectsInHierarchyView(property);
            }
            return(flag);
        }
Ejemplo n.º 9
0
        public static CPUElement Create(UnityEditorInternal.ProfilerProperty root)
        {
            allCPUEle = new List <CPUElement>();
            if (allCPUEle == null)
            {
                return(null);
            }
            if (root == null)
            {
                return(null);
            }
            CPUElement rootEle = new CPUElement()
            {
                FunctionName   = root.propertyName,
                TotalPercent   = root.GetColumn(ProfilerColumn.TotalPercent),
                SelfPercent    = root.GetColumn(ProfilerColumn.SelfPercent),
                Calls          = root.GetColumn(ProfilerColumn.Calls),
                GCMemory       = root.GetColumn(ProfilerColumn.GCMemory),
                TotalTime      = root.GetColumn(ProfilerColumn.TotalTime),
                SelfTime       = root.GetColumn(ProfilerColumn.SelfTime),
                RelatedObjName = root.GetColumn(ProfilerColumn.ObjectName),
                Depth          = root.depth
            };

            if (allCPUEle != null)
            {
                allCPUEle.Add(rootEle);
            }

            while (root.Next(root.HasChildren))
            {
                CPUElement ele = new CPUElement()
                {
                    FunctionName   = root.propertyName,
                    TotalPercent   = root.GetColumn(ProfilerColumn.TotalPercent),
                    SelfPercent    = root.GetColumn(ProfilerColumn.SelfPercent),
                    Calls          = root.GetColumn(ProfilerColumn.Calls),
                    GCMemory       = root.GetColumn(ProfilerColumn.GCMemory),
                    TotalTime      = root.GetColumn(ProfilerColumn.TotalTime),
                    SelfTime       = root.GetColumn(ProfilerColumn.SelfTime),
                    RelatedObjName = root.GetColumn(ProfilerColumn.ObjectName),
                    Depth          = root.depth
                };
                if (allCPUEle != null)
                {
                    allCPUEle.Add(ele);
                }
            }

            SetChildren();
            return(rootEle);
        }
 private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
 {
   bool expanded = false;
   Event current = Event.current;
   Rect rowRect = this.GetRowRect(rowCount);
   Rect currentRect = rowRect;
   GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);
   if (current.type == EventType.Repaint)
     rowBackgroundStyle.Draw(currentRect, GUIContent.none, false, false, selected, false);
   float num = (float) ((double) property.depth * 16.0 + 4.0);
   if (property.HasChildren)
   {
     bool flag = this.IsExpanded(property.propertyPath);
     GUI.changed = false;
     float x = num - 14f;
     expanded = GUI.Toggle(new Rect(x, currentRect.y, 14f, 16f), flag, GUIContent.none, ProfilerHierarchyGUI.styles.foldout);
     if (GUI.changed)
       this.SetExpanded(property, expanded);
     num = x + 16f;
   }
   string column = property.GetColumn(this.m_ColumnsToShow[0]);
   if (current.type == EventType.Repaint)
     this.DrawTextColumn(ref currentRect, column, 0, this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName ? 4f : num, selected);
   if (ProfilerInstrumentationPopup.InstrumentationEnabled && ProfilerInstrumentationPopup.FunctionHasInstrumentationPopup(column))
   {
     Rect rect = new Rect(Mathf.Clamp((float) ((double) currentRect.x + (double) num + 5.0) + ProfilerHierarchyGUI.styles.numberLabel.CalcSize(new GUIContent(column)).x, 0.0f, (float) ((double) this.m_Splitter.realSizes[0] - 30.0 + 2.0)), currentRect.y, 30f, 16f);
     if (GUI.Button(rect, ProfilerHierarchyGUI.styles.instrumentationIcon, ProfilerHierarchyGUI.styles.miniPullDown))
       ProfilerInstrumentationPopup.Show(rect, column);
   }
   if (current.type == EventType.Repaint)
   {
     ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
     int index1 = 1;
     for (int index2 = 1; index2 < this.m_VisibleColumns.Length; ++index2)
     {
       if (this.ColIsVisible(index2))
       {
         currentRect.x += (float) this.m_Splitter.realSizes[index1 - 1];
         currentRect.width = (float) this.m_Splitter.realSizes[index1] - 4f;
         ++index1;
         ProfilerHierarchyGUI.styles.numberLabel.Draw(currentRect, property.GetColumn(this.m_ColumnsToShow[index2]), false, false, false, selected);
       }
     }
     ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
   }
   if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
   {
     GUIUtility.hotControl = 0;
     if (!EditorGUI.actionKey)
     {
       if (this.m_DetailPane)
       {
         if (current.clickCount == 1 && property.instanceIDs.Length > 0)
         {
           string str = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
           if (this.m_DetailViewSelectedProperty != str)
           {
             this.m_DetailViewSelectedProperty = str;
             UnityEngine.Object gameObject = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
             if (gameObject is Component)
               gameObject = (UnityEngine.Object) ((Component) gameObject).gameObject;
             if (gameObject != (UnityEngine.Object) null)
               EditorGUIUtility.PingObject(gameObject.GetInstanceID());
           }
           else
             this.m_DetailViewSelectedProperty = string.Empty;
         }
         else if (current.clickCount == 2)
         {
           ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
           this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
         }
       }
       else
         this.RowMouseDown(property.propertyPath);
       this.DoScroll();
     }
     else if (!this.m_DetailPane)
       this.m_Window.ClearSelectedPropertyPath();
     else
       this.m_DetailViewSelectedProperty = string.Empty;
     GUIUtility.keyboardControl = id;
     current.Use();
   }
   if (selected && GUIUtility.keyboardControl == id && current.type == EventType.KeyDown && (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter))
     ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
   return expanded;
 }