Exemple #1
0
        void OnGUI()
        {
            using (var scope = new EditorGUILayout.VerticalScope())
            {
                using (var scope1 = new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button("Compare", GUILayout.Width(70)))
                    {
                        if (this._diffWindow.unpackedCrawlPrev == null || this._diffWindow.unpackedCrawl == null)
                        {
                            return;
                        }

                        CompareSnapshot(this._diffWindow.unpackedCrawlPrev, this._diffWindow.unpackedCrawl);
                    }
                    if (GUILayout.Button("Clear", GUILayout.Width(50)))
                    {
                        if (this._extraObjs != null)
                        {
                            this._extraObjs = null;
                        }
                    }
                    EditorGUIUtility.labelWidth = 160;
                    this._needCompareInstanceID = EditorGUILayout.Toggle("Need compare InstanceID: ", this._needCompareInstanceID);
                }

                if (this._extraObjs != null)
                {
                    EditorGUILayout.LabelField(string.Format("Result: {0}, TotalMemory: {1}", this._extraObjs.Length, EditorAssists.ToMemorySize(this._memorySize)));
                    this._scrollPosition = EditorGUILayout.BeginScrollView(this._scrollPosition);
                    for (int i = 0; i < this._extraObjs.Length; i++)
                    {
                        DrawNativeObject(this._extraObjs[i]);
                    }
                    EditorGUILayout.EndScrollView();
                }
            }
        }
Exemple #2
0
 private void DrawNativeObject(NativeUnityEngineObject nativeObject)
 {
     using (var scope = new EditorGUILayout.HorizontalScope())
     {
         string result = string.Format("classname:{0}, name: {1}, size: {2}", nativeObject.className, nativeObject.name, EditorAssists.ToMemorySize(nativeObject.size));
         EditorGUILayout.LabelField(result, GUILayout.MaxWidth(500));
         EditorGUILayout.Space();
         if (GUILayout.Button("Select", GUILayout.Width(50)))
         {
             this._diffWindow.SelectThing(nativeObject);
             this._diffWindow.Repaint();
         }
     }
 }
Exemple #3
0
        void OnGUI()
        {
            if (this._diffWindow == null || this._diffWindow.unpackedCrawl == null)
            {
                using (var rScope = new EditorGUILayout.VerticalScope())
                {
                    GUI.color = Color.red;
                    EditorGUILayout.LabelField("Has not snap memory...");
                    GUI.color = Color.white;
                }
                return;
            }

            var rUnpackedCrawl = this._diffWindow.unpackedCrawl;

            this.mObjectTypes = new List <string>();
            for (int i = 0; i < rUnpackedCrawl.nativeTypes.Length; i++)
            {
                if (string.IsNullOrEmpty(rUnpackedCrawl.nativeTypes[i].name))
                {
                    continue;
                }
                this.mObjectTypes.Add(rUnpackedCrawl.nativeTypes[i].name);
            }

            using (var rScope = new EditorGUILayout.VerticalScope())
            {
                EditorGUIUtility.labelWidth = 100;
                using (var rScope1 = new EditorGUILayout.HorizontalScope())
                {
                    mSelectedType   = EditorGUILayout.Popup("Object Types: ", mSelectedType, this.mObjectTypes.ToArray());
                    mNeedFilterType = EditorGUILayout.Toggle("NeedFilterType: ", mNeedFilterType, GUILayout.Width(120));
                    mSearchTypeText = this.mObjectTypes[mSelectedType];
                    mSearchTypeText = EditorGUILayout.TextField(mSearchTypeText, GUILayout.Width(90));
                    this.SearchType_Contain();

                    if (GUILayout.Button("Search", GUILayout.Width(90)))
                    {
                        this.Search(rUnpackedCrawl);
                    }
                }
            }

            if (mSearchResults != null)
            {
                this.mSearchFilterResults = this.SearchFilterContent();
                EditorGUILayout.LabelField(string.Format("Search results: {0}/{1}", mSearchFilterResults.Count, mSearchResults.Count));

                using (var rScope1 = new EditorGUILayout.HorizontalScope())
                {
                    EditorGUIUtility.labelWidth = 150;
                    mSearchText = EditorGUILayout.TextField("Filter Search Content: ", mSearchText);
                    if (GUILayout.Button("Clear", GUILayout.Width(90)))
                    {
                        if (mSearchResults != null)
                        {
                            mSearchResults.Clear();
                        }
                        if (mSearchFilterResults != null)
                        {
                            mSearchFilterResults.Clear();
                        }
                    }
                }

                EditorGUILayout.Space();
                mScrollPos = EditorGUILayout.BeginScrollView(mScrollPos);
                for (int i = (mCurPage - 1) * mPageCount; i < mCurPage * mPageCount; i++)
                {
                    if (i >= this.mSearchFilterResults.Count)
                    {
                        continue;
                    }

                    using (var rScope1 = new EditorGUILayout.HorizontalScope())
                    {
                        string result = string.Format(
                            "classname:{0}, name: {1}, size: {2}",
                            mSearchFilterResults[i].className,
                            mSearchFilterResults[i].name,
                            EditorAssists.ToMemorySize(mSearchFilterResults[i].size));

                        EditorGUILayout.LabelField(result);

                        if (GUILayout.Button("Select", GUILayout.Width(50)))
                        {
                            this._diffWindow.SelectThing(mSearchFilterResults[i]);
                            this._diffWindow.Repaint();
                        }
                    }
                }
                EditorGUILayout.EndScrollView();

                using (var rScope1 = new EditorGUILayout.HorizontalScope())
                {
                    int nTotalPage = this.mSearchFilterResults.Count / mPageCount + 1;

                    if (GUILayout.Button("上一页"))
                    {
                        mCurPage--;
                        mCurPage = Mathf.Clamp(mCurPage, 1, nTotalPage);
                    }
                    EditorGUILayout.LabelField(string.Format("{0}/{1}", mCurPage, nTotalPage), GUILayout.Width(40));
                    if (GUILayout.Button("下一页"))
                    {
                        mCurPage++;
                        mCurPage = Mathf.Clamp(mCurPage, 1, nTotalPage);
                    }
                }
            }
        }