示例#1
0
    // 绘制类型折叠列表
    private void DrawTypeFolderTitle(string typeName, int objectCount)
    {
        EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
        // 类型名
        _snapshotInfo.TypeToFoldedMap[typeName] = EditorGUILayout.Foldout(_snapshotInfo.TypeToFoldedMap[typeName], typeName);
        // 对象个数
        string objectCountStr = string.Format("对象数: {0}", objectCount);

        if (_lastSnapshotInfo != null)
        {
            if (_lastSnapshotInfo.GetTypeToObjectsMap().ContainsKey(typeName))
            {
                objectCountStr = GetDifference(objectCount, _lastSnapshotInfo.GetTypeToObjectsMap()[typeName].Count, objectCountStr);
            }
        }
        EditorGUILayout.LabelField(objectCountStr, GUILayout.ExpandWidth(false));
        // 所占大小
        int    typeSize    = _snapshotInfo.GetTypeSize(typeName);
        string typeSizeStr = string.Format("占用: {0}", EditorUtility.FormatBytes(typeSize));

        if (_lastSnapshotInfo != null)
        {
            typeSizeStr = GetDifferenceBytes(typeSize, _lastSnapshotInfo.GetTypeSize(typeName), typeSizeStr);
        }
        EditorGUILayout.LabelField(typeSizeStr, GUILayout.ExpandWidth(false));
        EditorGUILayout.EndHorizontal();
    }
示例#2
0
    // 绘制NativeObjects信息
    private void DrawNativeUnityEngineObjectInfo()
    {
        // 绘制概览信息
        DrawBriefInfo();

        _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos);
        foreach (var _typeToObjectsPair in _snapshotInfo.GetTypeToObjectsMap())
        {
            string typeName = _typeToObjectsPair.Key;
            List <PackedNativeUnityEngineObject> nativeObjects = _typeToObjectsPair.Value;

            // 绘制每个类型的折叠表头
            DrawTypeFolderTitle(typeName, nativeObjects.Count);

            // 绘制类型下的所有对象信息
            if (_snapshotInfo.TypeToFoldedMap[typeName])
            {
                DrawObjectsInfo(nativeObjects);
            }
        }
        EditorGUILayout.EndScrollView();
    }