예제 #1
0
        private void OnGUI()
        {
            GUI.Label(new Rect(0f, 0f, base.position.width, 20f), "Heapshots are located here: " + Path.Combine(Application.dataPath, "Heapshots"));
            GUI.Label(new Rect(0f, 20f, base.position.width, 20f), "Currently opened: " + this.lastOpenedHeapshotFile);
            GUI.Label(new Rect(100f, 40f, base.position.width, 20f), "Profiling: " + this.lastOpenedProfiler);
            this.DoActiveProfilerButton(new Rect(0f, 40f, 100f, 30f));
            if (GUI.Button(new Rect(0f, 70f, 200f, 20f), "CaptureHeapShot", EditorStyles.toolbarDropDown))
            {
                ProfilerDriver.CaptureHeapshot();
            }
            GUI.changed           = false;
            this.selectedHeapshot = EditorGUI.Popup(new Rect(250f, 70f, 500f, 30f), "Click to open -->", this.selectedHeapshot, this.heapshotFiles.ToArray());
            if (GUI.changed && this.heapshotFiles[this.selectedHeapshot].Length > 0)
            {
                this.OpenHeapshot(this.heapshotFiles[this.selectedHeapshot] + ".heapshot");
            }
            GUILayout.BeginArea(new Rect(0f, 90f, base.position.width, 60f));
            SplitterGUILayout.BeginHorizontalSplit(this.viewSplit, new GUILayoutOption[0]);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            string[] array = new string[]
            {
                "Roots",
                "All Objects"
            };
            for (int i = 0; i < array.Length; i++)
            {
                bool flag = GUILayout.Toggle(this.currentTab == i, array[i], EditorStyles.toolbarButton, new GUILayoutOption[]
                {
                    GUILayout.MaxHeight(16f)
                });
                if (flag)
                {
                    this.currentTab = i;
                }
            }
            GUILayout.EndHorizontal();
            this.DoTitles(this.titleSplit1);
            GUILayout.EndVertical();
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label("Back trace references", EditorStyles.toolbarButton, new GUILayoutOption[]
            {
                GUILayout.MaxHeight(16f)
            });
            this.DoTitles(this.titleSplit2);
            GUILayout.EndVertical();
            SplitterGUILayout.EndHorizontalSplit();
            GUILayout.EndArea();
            this.guiRect = new Rect(0f, 130f, (float)this.viewSplit.realSizes[0], 16f);
            float height   = (float)this.GetItemCount(this.hsAllObjects) * 16f;
            Rect  position = new Rect(this.guiRect.x, this.guiRect.y, this.guiRect.width, base.position.height - this.guiRect.y);

            this.leftViewScrollPosition = GUI.BeginScrollView(position, this.leftViewScrollPosition, new Rect(0f, 0f, position.width - 20f, height));
            this.itemIndex = 0;
            this.guiRect.y = 0f;
            int num = this.currentTab;

            if (num != 0)
            {
                if (num == 1)
                {
                    this.DoHeapshotObjects(this.hsAllObjects, this.titleSplit1, 0, new HeapshotWindow.OnSelect(this.OnSelectObject));
                }
            }
            else
            {
                this.DoHeapshotObjects(this.hsRoots, this.titleSplit1, 0, new HeapshotWindow.OnSelect(this.OnSelectObject));
            }
            GUI.EndScrollView();
            this.guiRect = new Rect((float)this.viewSplit.realSizes[0], 130f, (float)this.viewSplit.realSizes[1], 16f);
            float height2 = (float)this.GetItemCount(this.hsBackTraceObjects) * 16f;

            position = new Rect(this.guiRect.x, this.guiRect.y, this.guiRect.width, base.position.height - this.guiRect.y);
            this.rightViewScrollPosition = GUI.BeginScrollView(position, this.rightViewScrollPosition, new Rect(0f, 0f, position.width - 20f, height2));
            if (this.hsBackTraceObjects.Count > 0)
            {
                this.guiRect.y = 0f;
                this.itemIndex = 0;
                this.DoHeapshotObjects(this.hsBackTraceObjects, this.titleSplit2, 0, null);
            }
            GUI.EndScrollView();
        }