protected virtual void DrawItem(MemoryElement memoryElement, ref int row, int indent) { bool selected = this.m_MemorySelection.isSelected(memoryElement); DrawBackground(row, selected); Rect rect = GenerateRect(row); rect.x = (4f + (indent * 16f)) - 14f; Rect position = rect; position.width = 14f; if (memoryElement.ChildCount() > 0) { memoryElement.expanded = GUI.Toggle(position, memoryElement.expanded, GUIContent.none, styles.foldout); } rect.x += 14f; if (selected) { this.m_SelectionOffset = ((float) row) * 16f; } if ((Event.current.type == EventType.MouseDown) && rect.Contains(Event.current.mousePosition)) { this.RowClicked(Event.current, memoryElement); } this.DrawData(rect, memoryElement, indent, row, selected); if (memoryElement.expanded) { this.DrawRecursiveData(memoryElement, ref row, indent + 1); } }
protected virtual void DrawItem(MemoryElement memoryElement, ref int row, int indent) { bool flag = this.m_MemorySelection.isSelected(memoryElement); MemoryTreeList.DrawBackground(row, flag); Rect rect = MemoryTreeList.GenerateRect(row); rect.x = 4f + (float)indent * 16f - 14f; Rect position = rect; position.width = 14f; if (memoryElement.ChildCount() > 0) { memoryElement.expanded = GUI.Toggle(position, memoryElement.expanded, GUIContent.none, MemoryTreeList.styles.foldout); } rect.x += 14f; if (flag) { this.m_SelectionOffset = (float)row * 16f; } if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) { this.RowClicked(Event.current, memoryElement); } this.DrawData(rect, memoryElement, indent, row, flag); if (memoryElement.expanded) { this.DrawRecursiveData(memoryElement, ref row, indent + 1); } }
private static List<MemoryElement> GenerateObjectTypeGroups(UnityEditor.ObjectInfo[] memory, ObjectTypeFilter filter) { List<MemoryElement> list = new List<MemoryElement>(); MemoryElement item = null; foreach (UnityEditor.ObjectInfo info in memory) { if (GetObjectTypeFilter(info) == filter) { if ((item == null) || (info.className != item.name)) { item = new MemoryElement(info.className); list.Add(item); } item.AddChild(new MemoryElement(info, true)); } } list.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize)); foreach (MemoryElement element2 in list) { element2.children.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize)); if ((filter == ObjectTypeFilter.Other) && !HasValidNames(element2.children)) { element2.children.Clear(); } } return list; }
public static MemoryElement GetTreeRoot(ObjectMemoryInfo[] memoryObjectList, int[] referencesIndices) { UnityEditor.ObjectInfo[] array = new UnityEditor.ObjectInfo[memoryObjectList.Length]; for (int i = 0; i < memoryObjectList.Length; i++) { array[i] = new UnityEditor.ObjectInfo { instanceId = memoryObjectList[i].instanceId, memorySize = memoryObjectList[i].memorySize, reason = memoryObjectList[i].reason, name = memoryObjectList[i].name, className = memoryObjectList[i].className }; } int num2 = 0; for (int j = 0; j < memoryObjectList.Length; j++) { for (int k = 0; k < memoryObjectList[j].count; k++) { int index = referencesIndices[k + num2]; if (array[index].referencedBy == null) { array[index].referencedBy = new List<UnityEditor.ObjectInfo>(); } array[index].referencedBy.Add(array[j]); } num2 += memoryObjectList[j].count; } MemoryElement element = new MemoryElement(); Array.Sort<UnityEditor.ObjectInfo>(array, new Comparison<UnityEditor.ObjectInfo>(MemoryElementDataManager.SortByMemoryClassName)); element.AddChild(new MemoryElement("Scene Memory", GenerateObjectTypeGroups(array, ObjectTypeFilter.Scene))); element.AddChild(new MemoryElement("Assets", GenerateObjectTypeGroups(array, ObjectTypeFilter.Asset))); element.AddChild(new MemoryElement("Builtin Resources", GenerateObjectTypeGroups(array, ObjectTypeFilter.BuiltinResource))); element.AddChild(new MemoryElement("Not Saved", GenerateObjectTypeGroups(array, ObjectTypeFilter.DontSave))); element.AddChild(new MemoryElement("Other", GenerateObjectTypeGroups(array, ObjectTypeFilter.Other))); element.children.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize)); return element; }
public static MemoryElement GetTreeRoot(ObjectMemoryInfo[] memoryObjectList, int[] referencesIndices) { UnityEditor.ObjectInfo[] array = new UnityEditor.ObjectInfo[memoryObjectList.Length]; for (int i = 0; i < memoryObjectList.Length; i++) { array[i] = new UnityEditor.ObjectInfo { instanceId = memoryObjectList[i].instanceId, memorySize = memoryObjectList[i].memorySize, reason = memoryObjectList[i].reason, name = memoryObjectList[i].name, className = memoryObjectList[i].className }; } int num2 = 0; for (int j = 0; j < memoryObjectList.Length; j++) { for (int k = 0; k < memoryObjectList[j].count; k++) { int index = referencesIndices[k + num2]; if (array[index].referencedBy == null) { array[index].referencedBy = new List <UnityEditor.ObjectInfo>(); } array[index].referencedBy.Add(array[j]); } num2 += memoryObjectList[j].count; } MemoryElement element = new MemoryElement(); Array.Sort <UnityEditor.ObjectInfo>(array, new Comparison <UnityEditor.ObjectInfo>(MemoryElementDataManager.SortByMemoryClassName)); element.AddChild(new MemoryElement("Scene Memory", GenerateObjectTypeGroups(array, ObjectTypeFilter.Scene))); element.AddChild(new MemoryElement("Assets", GenerateObjectTypeGroups(array, ObjectTypeFilter.Asset))); element.AddChild(new MemoryElement("Builtin Resources", GenerateObjectTypeGroups(array, ObjectTypeFilter.BuiltinResource))); element.AddChild(new MemoryElement("Not Saved", GenerateObjectTypeGroups(array, ObjectTypeFilter.DontSave))); element.AddChild(new MemoryElement("Other", GenerateObjectTypeGroups(array, ObjectTypeFilter.Other))); element.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize)); return(element); }
protected override void DrawData(Rect rect, MemoryElement memoryElement, int indent, int row, bool selected) { if (Event.current.type == EventType.Repaint) { string name = memoryElement.name; if ((memoryElement.ChildCount() > 0) && (indent < 3)) { name = name + " (" + memoryElement.AccumulatedChildCount().ToString() + ")"; } int index = 0; rect.xMax = base.m_Splitter.realSizes[index]; MemoryTreeList.styles.numberLabel.Draw(rect, name, false, false, false, selected); rect.x = rect.xMax; rect.width = base.m_Splitter.realSizes[++index] - 4f; MemoryTreeList.styles.numberLabel.Draw(rect, EditorUtility.FormatBytes(memoryElement.totalMemory), false, false, false, selected); rect.x += base.m_Splitter.realSizes[index++]; rect.width = base.m_Splitter.realSizes[index] - 4f; if (memoryElement.ReferenceCount() > 0) { MemoryTreeList.styles.numberLabel.Draw(rect, memoryElement.ReferenceCount().ToString(), false, false, false, selected); } else if (selected) { MemoryTreeList.styles.numberLabel.Draw(rect, string.Empty, false, false, false, selected); } } }
private static List<MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter) { List<MemoryElement> list = new List<MemoryElement>(); MemoryElement memoryElement = null; for (int i = 0; i < memory.Length; i++) { ObjectInfo objectInfo = memory[i]; if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter) { if (memoryElement == null || objectInfo.className != memoryElement.name) { memoryElement = new MemoryElement(objectInfo.className); list.Add(memoryElement); } memoryElement.AddChild(new MemoryElement(objectInfo, true)); } } list.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize)); foreach (MemoryElement current in list) { current.children.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize)); if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children)) { current.children.Clear(); } } return list; }
protected override void DrawData(Rect rect, MemoryElement memoryElement, int indent, int row, bool selected) { if (Event.current.type == EventType.Repaint) { string text = memoryElement.name; if (memoryElement.ChildCount() > 0 && indent < 3) { text = text + " (" + memoryElement.AccumulatedChildCount().ToString() + ")"; } int num = 0; rect.xMax = (float)this.m_Splitter.realSizes[num]; MemoryTreeList.styles.numberLabel.Draw(rect, text, false, false, false, selected); rect.x = rect.xMax; rect.width = (float)this.m_Splitter.realSizes[++num] - 4f; MemoryTreeList.styles.numberLabel.Draw(rect, EditorUtility.FormatBytes(memoryElement.totalMemory), false, false, false, selected); rect.x += (float)this.m_Splitter.realSizes[num++]; rect.width = (float)this.m_Splitter.realSizes[num] - 4f; if (memoryElement.ReferenceCount() > 0) { MemoryTreeList.styles.numberLabel.Draw(rect, memoryElement.ReferenceCount().ToString(), false, false, false, selected); } else if (selected) { MemoryTreeList.styles.numberLabel.Draw(rect, "", false, false, false, selected); } } }
public MemoryElement GetNextNode() { if (this.expanded && this.children.Count > 0) { return(this.children[0]); } int num = this.GetChildIndexInList() + 1; if (num < this.parent.children.Count) { return(this.parent.children[num]); } MemoryElement memoryElement = this.parent; while (memoryElement.parent != null) { int num2 = memoryElement.GetChildIndexInList() + 1; if (num2 < memoryElement.parent.children.Count) { return(memoryElement.parent.children[num2]); } memoryElement = memoryElement.parent; } return(null); }
private static List <MemoryElement> GenerateObjectTypeGroups(UnityEditor.ObjectInfo[] memory, ObjectTypeFilter filter) { List <MemoryElement> list = new List <MemoryElement>(); MemoryElement item = null; foreach (UnityEditor.ObjectInfo info in memory) { if (GetObjectTypeFilter(info) == filter) { if ((item == null) || (info.className != item.name)) { item = new MemoryElement(info.className); list.Add(item); } item.AddChild(new MemoryElement(info, true)); } } list.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize)); foreach (MemoryElement element2 in list) { element2.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize)); if ((filter == ObjectTypeFilter.Other) && !HasValidNames(element2.children)) { element2.children.Clear(); } } return(list); }
private static List <MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter) { List <MemoryElement> list = new List <MemoryElement>(); MemoryElement memoryElement = null; for (int i = 0; i < memory.Length; i++) { ObjectInfo objectInfo = memory[i]; if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter) { if (memoryElement == null || objectInfo.className != memoryElement.name) { memoryElement = new MemoryElement(objectInfo.className); list.Add(memoryElement); } memoryElement.AddChild(new MemoryElement(objectInfo, true)); } } list.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize)); foreach (MemoryElement current in list) { current.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize)); if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children)) { current.children.Clear(); } } return(list); }
protected override void DrawData(Rect rect, MemoryElement memoryElement, int indent, int row, bool selected) { if (Event.current.type != EventType.Repaint) { return; } string displayName = memoryElement.name; if (memoryElement.ChildCount() > 0 && indent < 3) { displayName += " (" + memoryElement.AccumulatedChildCount() + ")"; } int currentColumn = 0; rect.xMax = m_Splitter.realSizes[currentColumn]; styles.numberLabel.Draw(rect, displayName, false, false, false, selected); rect.x = rect.xMax; rect.width = m_Splitter.realSizes[++currentColumn] - kSmallMargin; styles.numberLabel.Draw(rect, EditorUtility.FormatBytes(memoryElement.totalMemory), false, false, false, selected); rect.x += m_Splitter.realSizes[currentColumn++]; rect.width = m_Splitter.realSizes[currentColumn] - kSmallMargin; if (memoryElement.ReferenceCount() > 0) { styles.numberLabel.Draw(rect, memoryElement.ReferenceCount().ToString(), false, false, false, selected); } else if (selected) { styles.numberLabel.Draw(rect, "", false, false, false, selected); } }
public MemoryElement GetNextNode() { if (expanded && children.Count > 0) { return(children[0]); } int nextsiblingindex = GetChildIndexInList() + 1; if (nextsiblingindex < parent.children.Count) { return(parent.children[nextsiblingindex]); } MemoryElement p = parent; while (p.parent != null) { int parentsiblingindex = p.GetChildIndexInList() + 1; if (parentsiblingindex < p.parent.children.Count) { return(p.parent.children[parentsiblingindex]); } p = p.parent; } return(null); }
public MemoryElement GetNextNode() { MemoryElement result; if (this.expanded && this.children.Count > 0) { result = this.children[0]; } else { int num = this.GetChildIndexInList() + 1; if (num < this.parent.children.Count) { result = this.parent.children[num]; } else { MemoryElement memoryElement = this.parent; while (memoryElement.parent != null) { int num2 = memoryElement.GetChildIndexInList() + 1; if (num2 < memoryElement.parent.children.Count) { result = memoryElement.parent.children[num2]; return(result); } memoryElement = memoryElement.parent; } result = null; } } return(result); }
private static List <MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter) { List <MemoryElement> memoryElementList = new List <MemoryElement>(); MemoryElement memoryElement = (MemoryElement)null; foreach (ObjectInfo objectInfo in memory) { if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter) { if (memoryElement == null || objectInfo.className != memoryElement.name) { memoryElement = new MemoryElement(objectInfo.className); memoryElementList.Add(memoryElement); } memoryElement.AddChild(new MemoryElement(objectInfo, true)); } } memoryElementList.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize)); using (List <MemoryElement> .Enumerator enumerator = memoryElementList.GetEnumerator()) { while (enumerator.MoveNext()) { MemoryElement current = enumerator.Current; current.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize)); if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children)) { current.children.Clear(); } } } return(memoryElementList); }
private static List<MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter) { List<MemoryElement> memoryElementList = new List<MemoryElement>(); MemoryElement memoryElement = (MemoryElement) null; foreach (ObjectInfo objectInfo in memory) { if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter) { if (memoryElement == null || objectInfo.className != memoryElement.name) { memoryElement = new MemoryElement(objectInfo.className); memoryElementList.Add(memoryElement); } memoryElement.AddChild(new MemoryElement(objectInfo, true)); } } memoryElementList.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize)); using (List<MemoryElement>.Enumerator enumerator = memoryElementList.GetEnumerator()) { while (enumerator.MoveNext()) { MemoryElement current = enumerator.Current; current.children.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize)); if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children)) current.children.Clear(); } } return memoryElementList; }
public void SetSelection(MemoryElement node) { this.m_Selected = node; for (MemoryElement element = node.parent; element != null; element = element.parent) { element.expanded = true; } }
protected virtual void DrawData(Rect rect, MemoryElement memoryElement, int indent, int row, bool selected) { if (Event.current.type == EventType.Repaint) { string text = memoryElement.name + "(" + memoryElement.memoryInfo.className + ")"; styles.numberLabel.Draw(rect, text, false, false, false, selected); } }
public void SetSelection(MemoryElement node) { this.m_Selected = node; for (MemoryElement parent = node.parent; parent != null; parent = parent.parent) { parent.expanded = true; } }
protected virtual void DrawData(Rect rect, MemoryElement memoryElement, int indent, int row, bool selected) { if (Event.current.type == EventType.Repaint) { string text = memoryElement.name + "(" + memoryElement.memoryInfo.className + ")"; MemoryTreeList.styles.numberLabel.Draw(rect, text, false, false, false, selected); } }
public MemoryElement(string n) { this.children = null; this.parent = null; this.expanded = false; this.name = n; this.children = new List <MemoryElement>(); this.description = ""; }
public MemoryElement(string n) { this.children = null; this.parent = null; this.expanded = false; this.name = n; this.children = new List<MemoryElement>(); this.description = ""; }
protected virtual void DrawData(Rect rect, MemoryElement memoryElement, int indent, int row, bool selected) { if (Event.current.type != EventType.Repaint) { return; } string displayName = memoryElement.name + "(" + memoryElement.memoryInfo.className + ")"; styles.numberLabel.Draw(rect, displayName, false, false, false, selected); }
public void AddChild(MemoryElement node) { if (node == this) { throw new Exception("Should not AddChild to itself"); } this.children.Add(node); node.parent = this; this.totalMemory += node.totalMemory; this.totalChildCount += node.totalChildCount; }
public void MoveDown() { if ((this.m_Selected != null) && (this.m_Selected.parent != null)) { MemoryElement nextNode = this.m_Selected.GetNextNode(); if (nextNode != null) { this.SetSelection(nextNode); } } }
protected void DrawRecursiveData(MemoryElement element, ref int row, int indent) { if (element.ChildCount() != 0) { element.ExpandChildren(); foreach (MemoryElement current in element.children) { row++; this.DrawItem(current, ref row, indent); } } }
public void SetRoot(MemoryElement root) { this.m_Root = root; if (this.m_Root != null) { this.m_Root.ExpandChildren(); } if (this.m_DetailView != null) { this.m_DetailView.SetRoot(null); } }
public void SetSelection(MemoryElement node) { m_Selected = node; MemoryElement parent = node.parent; while (parent != null) { parent.expanded = true; parent = parent.parent; } }
private bool FindNamedChild(string name, List <MemoryElement> list, out MemoryElement outChild) { foreach (var child in list) { if (child.name == name) { outChild = child; return(true); } } outChild = null; return(false); }
private bool FindNamedChild(string name, List <MemoryElement> list, out MemoryElement outChild) { foreach (MemoryElement element in list) { if (element.name == name) { outChild = element; return(true); } } outChild = null; return(false); }
public static MemoryElement GetTreeRoot(ObjectMemoryInfo[] memoryObjectList, int[] referencesIndices) { ObjectInfo[] array = new ObjectInfo[memoryObjectList.Length]; for (int i = 0; i < memoryObjectList.Length; i++) { array[i] = new ObjectInfo { instanceId = memoryObjectList[i].instanceId, memorySize = memoryObjectList[i].memorySize, reason = memoryObjectList[i].reason, name = memoryObjectList[i].name, className = memoryObjectList[i].className }; } int num = 0; for (int j = 0; j < memoryObjectList.Length; j++) { for (int k = 0; k < memoryObjectList[j].count; k++) { int num2 = referencesIndices[k + num]; if (array[num2].referencedBy == null) { array[num2].referencedBy = new List <ObjectInfo>(); } array[num2].referencedBy.Add(array[j]); } num += memoryObjectList[j].count; } MemoryElement memoryElement = new MemoryElement(); ObjectInfo[] arg_113_0 = array; if (MemoryElementDataManager.< > f__mg$cache2 == null) { MemoryElementDataManager.< > f__mg$cache2 = new Comparison <ObjectInfo>(MemoryElementDataManager.SortByMemoryClassName); } Array.Sort <ObjectInfo>(arg_113_0, MemoryElementDataManager.< > f__mg$cache2); memoryElement.AddChild(new MemoryElement("Scene Memory", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.Scene))); memoryElement.AddChild(new MemoryElement("Assets", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.Asset))); memoryElement.AddChild(new MemoryElement("Builtin Resources", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.BuiltinResource))); memoryElement.AddChild(new MemoryElement("Not Saved", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.DontSave))); memoryElement.AddChild(new MemoryElement("Other", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.Other))); List <MemoryElement> arg_1B4_0 = memoryElement.children; if (MemoryElementDataManager.< > f__mg$cache3 == null) { MemoryElementDataManager.< > f__mg$cache3 = new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize); } arg_1B4_0.Sort(MemoryElementDataManager.< > f__mg$cache3); return(memoryElement); }
public MemoryElement(ObjectInfo memInfo, bool finalize) { this.children = null; this.parent = null; this.expanded = false; this.memoryInfo = memInfo; this.name = this.memoryInfo.name; this.totalMemory = (memInfo == null) ? 0 : memInfo.memorySize; this.totalChildCount = 1; if (finalize) { this.children = new List <MemoryElement>(); } }
public MemoryElement(ObjectInfo memInfo, bool finalize) { this.children = null; this.parent = null; this.expanded = false; this.memoryInfo = memInfo; this.name = this.memoryInfo.name; this.totalMemory = (memInfo == null) ? 0 : memInfo.memorySize; this.totalChildCount = 1; if (finalize) { this.children = new List<MemoryElement>(); } }
protected override void DrawData(Rect rect, MemoryElement memoryElement, int indent, int row, bool selected) { if (Event.current.type != EventType.Repaint) { return; } string text = memoryElement.name; if (memoryElement.ChildCount() > 0 && indent < 3) { text = text + " (" + memoryElement.AccumulatedChildCount().ToString() + ")"; } int index1 = 0; rect.xMax = (float)this.m_Splitter.realSizes[index1]; MemoryTreeList.styles.numberLabel.Draw(rect, text, false, false, false, selected); rect.x = rect.xMax; int num1; rect.width = (float)this.m_Splitter.realSizes[num1 = index1 + 1] - 4f; MemoryTreeList.styles.numberLabel.Draw(rect, EditorUtility.FormatBytes(memoryElement.totalMemory), false, false, false, selected); // ISSUE: explicit reference operation // ISSUE: variable of a reference type Rect& local = @rect; // ISSUE: explicit reference operation double x = (double)(^ local).x; int[] realSizes = this.m_Splitter.realSizes; int index2 = num1; int num2 = 1; int index3 = index2 + num2; double num3 = (double)realSizes[index2]; double num4 = x + num3; // ISSUE: explicit reference operation (^ local).x = (float)num4; rect.width = (float)this.m_Splitter.realSizes[index3] - 4f; if (memoryElement.ReferenceCount() > 0) { MemoryTreeList.styles.numberLabel.Draw(rect, memoryElement.ReferenceCount().ToString(), false, false, false, selected); } else { if (!selected) { return; } MemoryTreeList.styles.numberLabel.Draw(rect, string.Empty, false, false, false, selected); } }
protected void DrawRecursiveData(MemoryElement element, ref int row, int indent) { if (element.ChildCount() == 0) { return; } element.ExpandChildren(); foreach (MemoryElement elem in element.children) { row++; DrawItem(elem, ref row, indent); } }
public void MoveDown() { if (this.m_Selected == null || this.m_Selected.parent == null) { return; } MemoryElement nextNode = this.m_Selected.GetNextNode(); if (nextNode == null) { return; } this.SetSelection(nextNode); }
public MemoryElement(string n, List <MemoryElement> groups) { this.children = null; this.parent = null; this.name = n; this.expanded = false; this.description = ""; this.totalMemory = 0; this.totalChildCount = 0; this.children = new List <MemoryElement>(); foreach (MemoryElement element in groups) { this.AddChild(element); } }
public void MoveUp() { if ((this.m_Selected != null) && (this.m_Selected.parent != null)) { MemoryElement prevNode = this.m_Selected.GetPrevNode(); if (prevNode.parent != null) { this.SetSelection(prevNode); } else { this.SetSelection(prevNode.FirstChild()); } } }
public MemoryElement GetPrevNode() { int num = this.GetChildIndexInList() - 1; if (num >= 0) { MemoryElement memoryElement = this.parent.children[num]; while (memoryElement.expanded) { memoryElement = memoryElement.children[memoryElement.children.Count - 1]; } return(memoryElement); } return(this.parent); }
public MemoryElement(string n, List<MemoryElement> groups) { this.children = null; this.parent = null; this.name = n; this.expanded = false; this.description = ""; this.totalMemory = 0; this.totalChildCount = 0; this.children = new List<MemoryElement>(); foreach (MemoryElement element in groups) { this.AddChild(element); } }
private static List<MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, ObjectTypeFilter filter) { List<MemoryElement> list = new List<MemoryElement>(); MemoryElement item = null; foreach (ObjectInfo info in memory) { if (GetObjectTypeFilter(info) == filter) { if ((item == null) || (info.className != item.name)) { item = new MemoryElement(info.className); list.Add(item); } item.AddChild(new MemoryElement(info, true)); } } if (<>f__mg$cache0 == null) {
protected override void DrawData(Rect rect, MemoryElement memoryElement, int indent, int row, bool selected) { if (Event.current.type != EventType.Repaint) return; string text = memoryElement.name; if (memoryElement.ChildCount() > 0 && indent < 3) text = text + " (" + memoryElement.AccumulatedChildCount().ToString() + ")"; int index1 = 0; rect.xMax = (float) this.m_Splitter.realSizes[index1]; MemoryTreeList.styles.numberLabel.Draw(rect, text, false, false, false, selected); rect.x = rect.xMax; int num1; rect.width = (float) this.m_Splitter.realSizes[num1 = index1 + 1] - 4f; MemoryTreeList.styles.numberLabel.Draw(rect, EditorUtility.FormatBytes(memoryElement.totalMemory), false, false, false, selected); // ISSUE: explicit reference operation // ISSUE: variable of a reference type Rect& local = @rect; // ISSUE: explicit reference operation double x = (double) (^local).x; int[] realSizes = this.m_Splitter.realSizes; int index2 = num1; int num2 = 1; int index3 = index2 + num2; double num3 = (double) realSizes[index2]; double num4 = x + num3; // ISSUE: explicit reference operation (^local).x = (float) num4; rect.width = (float) this.m_Splitter.realSizes[index3] - 4f; if (memoryElement.ReferenceCount() > 0) { MemoryTreeList.styles.numberLabel.Draw(rect, memoryElement.ReferenceCount().ToString(), false, false, false, selected); } else { if (!selected) return; MemoryTreeList.styles.numberLabel.Draw(rect, string.Empty, false, false, false, selected); } }
private static int SortByMemorySize(MemoryElement x, MemoryElement y) { return y.totalMemory.CompareTo(x.totalMemory); }
private void RecursiveFindSelected(MemoryElement element, ref int row) { if (this.m_MemorySelection.isSelected(element)) this.m_SelectionOffset = (float) row * 16f; row = row + 1; if (!element.expanded || element.ChildCount() == 0) return; element.ExpandChildren(); using (List<MemoryElement>.Enumerator enumerator = element.children.GetEnumerator()) { while (enumerator.MoveNext()) this.RecursiveFindSelected(enumerator.Current, ref row); } }
protected virtual void DrawItem(MemoryElement memoryElement, ref int row, int indent) { bool selected = this.m_MemorySelection.isSelected(memoryElement); MemoryTreeList.DrawBackground(row, selected); Rect rect = MemoryTreeList.GenerateRect(row); rect.x = (float) (4.0 + (double) indent * 16.0 - 14.0); Rect position = rect; position.width = 14f; if (memoryElement.ChildCount() > 0) memoryElement.expanded = GUI.Toggle(position, memoryElement.expanded, GUIContent.none, MemoryTreeList.styles.foldout); rect.x += 14f; if (selected) this.m_SelectionOffset = (float) row * 16f; if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) this.RowClicked(Event.current, memoryElement); this.DrawData(rect, memoryElement, indent, row, selected); if (!memoryElement.expanded) return; this.DrawRecursiveData(memoryElement, ref row, indent + 1); }
public void ClearSelection() { this.m_Selected = (MemoryElement) null; }
protected void RowClicked(Event evt, MemoryElement memoryElement) { this.m_MemorySelection.SetSelection(memoryElement); GUIUtility.keyboardControl = this.m_ControlID; if (((evt.clickCount == 2) && (memoryElement.memoryInfo != null)) && (memoryElement.memoryInfo.instanceId != 0)) { Selection.instanceIDs = new int[0]; Selection.activeInstanceID = memoryElement.memoryInfo.instanceId; } evt.Use(); if (memoryElement.memoryInfo != null) { EditorGUIUtility.PingObject(memoryElement.memoryInfo.instanceId); } if (this.m_DetailView != null) { this.m_DetailView.SetRoot((memoryElement.memoryInfo != null) ? new MemoryElement(memoryElement.memoryInfo, false) : null); } this.m_EditorWindow.Repaint(); }
private void RestoreViewState(MemoryElement oldRoot, MemoryElement newRoot) { foreach (MemoryElement element in newRoot.children) { element.ExpandChildren(); if (element.ChildCount() != 0) { MemoryElement outChild = null; if (this.FindNamedChild(element.name, oldRoot.children, out outChild)) { element.expanded = outChild.expanded; if (element.expanded) { this.RestoreViewState(outChild, element); } } } } }
public void ClearSelection() { this.m_Selected = null; }
public static MemoryElement GetTreeRoot(ObjectMemoryInfo[] memoryObjectList, int[] referencesIndices) { ObjectInfo[] objectInfoArray = new ObjectInfo[memoryObjectList.Length]; for (int index = 0; index < memoryObjectList.Length; ++index) objectInfoArray[index] = new ObjectInfo() { instanceId = memoryObjectList[index].instanceId, memorySize = memoryObjectList[index].memorySize, reason = memoryObjectList[index].reason, name = memoryObjectList[index].name, className = memoryObjectList[index].className }; int num = 0; for (int index1 = 0; index1 < memoryObjectList.Length; ++index1) { for (int index2 = 0; index2 < memoryObjectList[index1].count; ++index2) { int referencesIndex = referencesIndices[index2 + num]; if (objectInfoArray[referencesIndex].referencedBy == null) objectInfoArray[referencesIndex].referencedBy = new List<ObjectInfo>(); objectInfoArray[referencesIndex].referencedBy.Add(objectInfoArray[index1]); } num += memoryObjectList[index1].count; } MemoryElement memoryElement = new MemoryElement(); Array.Sort<ObjectInfo>(objectInfoArray, new Comparison<ObjectInfo>(MemoryElementDataManager.SortByMemoryClassName)); memoryElement.AddChild(new MemoryElement("Scene Memory", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.Scene))); memoryElement.AddChild(new MemoryElement("Assets", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.Asset))); memoryElement.AddChild(new MemoryElement("Builtin Resources", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.BuiltinResource))); memoryElement.AddChild(new MemoryElement("Not Saved", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.DontSave))); memoryElement.AddChild(new MemoryElement("Other", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.Other))); memoryElement.children.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize)); return memoryElement; }
public bool isSelected(MemoryElement node) { return (this.m_Selected == node); }
protected void DrawRecursiveData(MemoryElement element, ref int row, int indent) { if (element.ChildCount() != 0) { element.ExpandChildren(); foreach (MemoryElement element2 in element.children) { row++; this.DrawItem(element2, ref row, indent); } } }
private void RecursiveFindSelected(MemoryElement element, ref int row) { if (this.m_MemorySelection.isSelected(element)) { this.m_SelectionOffset = ((float) row) * 16f; } row++; if (element.expanded && (element.ChildCount() != 0)) { element.ExpandChildren(); foreach (MemoryElement element2 in element.children) { this.RecursiveFindSelected(element2, ref row); } } }
private void RecursiveFindSelected(MemoryElement element, ref int row) { if (this.m_MemorySelection.isSelected(element)) { this.m_SelectionOffset = (float)row * 16f; } row++; if (!element.expanded || element.ChildCount() == 0) { return; } element.ExpandChildren(); foreach (MemoryElement current in element.children) { this.RecursiveFindSelected(current, ref row); } }
public MemoryElement() { this.children = null; this.parent = null; this.children = new List<MemoryElement>(); }
private bool FindNamedChild(string name, List<MemoryElement> list, out MemoryElement outChild) { foreach (MemoryElement element in list) { if (element.name == name) { outChild = element; return true; } } outChild = null; return false; }
public void SetRoot(MemoryElement root) { MemoryElement oldRoot = this.m_Root; this.m_Root = root; if (this.m_Root != null) { this.m_Root.ExpandChildren(); } if (this.m_DetailView != null) { this.m_DetailView.SetRoot(null); } if ((oldRoot != null) && (this.m_Root != null)) { this.RestoreViewState(oldRoot, this.m_Root); } }