Пример #1
0
        protected override void DrawResultsInternal(SpriteDatabase spriteDatabase)
        {
            if (uniqueUsedScenes == null)
            {
                return;
            }

            for (int i = 0; i < uniqueUsedScenes.Length; i++)
            {
                SceneAsset sceneAsset = uniqueUsedScenes[i];

                EditorGUILayout.BeginVertical("Box");

                if (SpriteAuditorGUIUtility.DrawObjectFoldout(sceneAsset, sceneAsset.name))
                {
                    EditorGUI.indentLevel++;
                    if (sceneToSingleSprites[sceneAsset].Length > 0)
                    {
                        EditorGUILayout.BeginVertical("Box");

                        if (SpriteAuditorGUIUtility.DrawStringFoldout($"Sprites Without Atlas [{sceneToSingleSprites[sceneAsset].Length}] ", $"{sceneAsset.name}_SceneViewSpritesWithoutAtlas"))
                        {
                            EditorGUI.indentLevel++;
                            foreach (SpriteData spriteData in sceneToSingleSprites[sceneAsset])
                            {
                                DrawSpriteDataField(spriteData);
                            }

                            SpriteAuditorUtility.DrawDefaultSelectionOptions(sceneToSingleSprites[sceneAsset]
                                                                             .Select(spriteData => spriteData.Sprite).Cast <Object>().ToList());
                            EditorGUI.indentLevel--;
                        }
                        EditorGUILayout.EndVertical();
                    }

                    if (sceneToAtlasToUsedSprites.ContainsKey(sceneAsset))
                    {
                        foreach (var atlasToUSedSprites in sceneToAtlasToUsedSprites[sceneAsset])
                        {
                            EditorGUILayout.BeginVertical("Box");

                            {
                                if (SpriteAuditorGUIUtility.DrawObjectFoldout(atlasToUSedSprites.Key,
                                                                              $"{VisualizationType.Scene.ToString()}_{atlasToUSedSprites.Key}"))
                                {
                                    EditorGUI.indentLevel++;
                                    foreach (SpriteData spriteData in sceneToAtlasToUsedSprites[sceneAsset][
                                                 atlasToUSedSprites.Key])
                                    {
                                        DrawSpriteDataField(spriteData);
                                    }

                                    SpriteAuditorUtility.DrawDefaultSelectionOptions(
                                        sceneToAtlasToUsedSprites[sceneAsset][atlasToUSedSprites.Key]
                                        .Select(spriteData => spriteData.Sprite).Cast <Object>().ToList());
                                    EditorGUI.indentLevel--;
                                }
                            }
                            EditorGUILayout.EndVertical();
                        }
                    }

                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndVertical();
            }
        }
Пример #2
0
        protected override void DrawResultsInternal(SpriteDatabase spriteDatabase)
        {
            for (int i = 0; i < filteredAtlas.Length; i++)
            {
                SpriteAtlas atlas = filteredAtlas[i];

                EditorGUILayout.BeginVertical("Box");

                if (SpriteAuditorGUIUtility.DrawObjectFoldout(atlas,
                                                              $"{VisualizationType.Atlas.ToString()}_{atlas.name}"))
                {
                    EditorGUI.indentLevel++;

                    if (atlasToUsedSprites[atlas].Length > 0)
                    {
                        if (SpriteAuditorGUIUtility.DrawStringFoldout(
                                $"Used Sprites [{atlasToUsedSprites[atlas].Length}] ",
                                $"{VisualizationType.Atlas.ToString()}_{atlas.name}_used_sprites"))
                        {
                            EditorGUI.indentLevel++;

                            for (int j = 0; j < atlasToUsedSprites[atlas].Length; j++)
                            {
                                SpriteData spriteData = atlasToUsedSprites[atlas][j];
                                DrawSpriteDataField(spriteData);
                            }

                            SpriteAuditorUtility.DrawDefaultSelectionOptions(atlasToNotUsedSprites[atlas]);

                            EditorGUI.indentLevel--;
                        }
                    }

                    if (atlasToNotUsedSprites[atlas].Length > 0)
                    {
                        if (SpriteAuditorGUIUtility.DrawStringFoldout(
                                $"Not Used Sprites [{atlasToNotUsedSprites[atlas].Length}] ",
                                $"{VisualizationType.Atlas.ToString()}_{atlas.name}_not_used_sprites"))
                        {
                            EditorGUI.indentLevel++;

                            for (int j = 0; j < atlasToNotUsedSprites[atlas].Length; j++)
                            {
                                Sprite sprite = atlasToNotUsedSprites[atlas][j];
                                if (sprite == null)
                                {
                                    continue;
                                }

                                SpriteAuditorGUIUtility.DrawObjectFoldout(sprite,
                                                                          $"{VisualizationType.Atlas.ToString()}_{atlas.name}_{sprite.name}", false, true);
                            }

                            SpriteAuditorUtility.DrawDefaultSelectionOptions(atlasToNotUsedSprites[atlas]);
                            EditorGUI.indentLevel--;
                        }
                    }

                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.EndVertical();
            }
        }