Exemple #1
0
        // Token: 0x060003B5 RID: 949 RVA: 0x00033198 File Offset: 0x00031398
        private Dictionary <string, int> CountRendererInScene()
        {
            Dictionary <string, int> dictionary = new Dictionary <string, int>();

            foreach (GameObject gameObject in EditorUtility2.GetSceneRootObjects())
            {
                this.CountRendererInSceneRecursive(gameObject.transform, dictionary);
            }
            return(dictionary);
        }
Exemple #2
0
        // Token: 0x060003CE RID: 974 RVA: 0x00033C08 File Offset: 0x00031E08
        private void DrawUsageInfo(TextureMemoryUsageInfo usageInfo, string title)
        {
            float num  = 80f;
            float num2 = 65f;
            float num3 = 120f;
            float num4 = 50f;

            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label(title, EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUILayout.Space(2f);
            if (usageInfo.UsagePerType.Count > 0)
            {
                float num5 = 1f / usageInfo.UsagePerType[0].Percentage;
                foreach (TextureMemoryUsageData textureMemoryUsageData in usageInfo.UsagePerType)
                {
                    EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.Label(TextureUtil2.GetTextureTypeString(textureMemoryUsageData.TextureType, textureMemoryUsageData.TextureShape), new GUILayoutOption[]
                    {
                        GUILayout.Width(num)
                    });
                    GUILayout.Label(EditorUtility2.FormatBytes(textureMemoryUsageData.Size), GUIStyles.LabelRight, new GUILayoutOption[]
                    {
                        GUILayout.Width(num2)
                    });
                    Color color = GUIColors.TintIfPlaying(TextureUtil2.GetTextureImporterTypeChartColor(textureMemoryUsageData.TextureType, textureMemoryUsageData.TextureShape));
                    EditorGUI.DrawRect(GUILayoutUtility.GetRect(1f, 19f, new GUILayoutOption[]
                    {
                        GUILayout.Width(Mathf.Max(1f, textureMemoryUsageData.Percentage * num3 * num5))
                    }), color);
                    GUILayout.Label(string.Format("{0:F1}%", textureMemoryUsageData.Percentage * 100f), new GUILayoutOption[]
                    {
                        GUILayout.Width(num4)
                    });
                    EditorGUILayout.EndHorizontal();
                    GUILayout.Space(1f);
                }
            }
            GUILayout.Label(string.Format("= {0}", EditorUtility2.FormatBytes(usageInfo.TotalSize)), GUIStyles.BoldLabelRight, new GUILayoutOption[]
            {
                GUILayout.Width(8f + num + num2)
            });
            EditorGUILayout.EndVertical();
        }
Exemple #3
0
        // Token: 0x060003B4 RID: 948 RVA: 0x00033044 File Offset: 0x00031244
        private void DoPickModeChange(MainWindow.PickMode newpickmode, bool checkTimeStamp)
        {
            this._listview.SetSceneOccurrenceLookup(null);
            switch (newpickmode)
            {
            case MainWindow.PickMode.Selection:
                this._listview.SetItems(new List <string>());
                this.OnSelectionChange();
                break;

            case MainWindow.PickMode.Project:
                this._listview.SetItems(new List <string>(AssetDatabase.GetAllAssetPaths()));
                break;

            case MainWindow.PickMode.Scene:
            {
                List <Object> list = new List <Object>(EditorUtility.CollectDependencies(EditorUtility2.GetSceneRootObjects().ToArray()));
                if (RenderSettings.skybox != null)
                {
                    list.AddRange(EditorUtility.CollectDependencies(new Material[]
                        {
                            RenderSettings.skybox
                        }));
                }
                if (Globals.CountRendererInSceneMode)
                {
                    Dictionary <string, int> sceneOccurrenceLookup = this.CountRendererInScene();
                    this._listview.SetSceneOccurrenceLookup(sceneOccurrenceLookup);
                }
                List <string> list2 = new List <string>(128);
                foreach (Object @object in list)
                {
                    if (@object is Texture)
                    {
                        string assetPath = AssetDatabase.GetAssetPath(@object);
                        if (!string.IsNullOrEmpty(assetPath))
                        {
                            list2.Add(assetPath);
                        }
                    }
                }
                this._listview.SetItems(list2);
                break;
            }

            case MainWindow.PickMode.AssetBundleManifest:
                this._listview.SetItems(new List <string>());
                break;
            }
            this.UpdateMemoryUsage();
        }