Example #1
0
        private void Initialize()
        {
            titleContent = new GUIContent("FindDependencyAssetsWindow");
            minSize      = MinWindowSize;

            // 参照情報を収集.
            findDependencyAssets.CollectDependencies();

            // 依存情報を構築.
            if (findDependencyAssets.AssetBundleDependentInfos.Any())
            {
                var list = new List <AssetBundleInfo>();

                var count = 0;
                var size  = findDependencyAssets.AssetBundleDependentInfos.Count;

                foreach (var item in findDependencyAssets.AssetBundleDependentInfos)
                {
                    EditorUtility.DisplayProgressBar("Find Dependency", item.Key, (float)count / size);

                    list.Add(new AssetBundleInfo(item.Key, item.Value.AssetPaths, item.Value.DependentAssetPaths));

                    count++;
                }

                assetBundleInfo = list.ToArray();

                EditorUtility.ClearProgressBar();
            }
            else
            {
                assetBundleInfo = new AssetBundleInfo[0];
            }

            // 参照情報を構築.
            if (findDependencyAssets.ReferenceInfos.Any())
            {
                var list = new List <AssetReferenceInfo>();

                var count = 0;
                var size  = findDependencyAssets.ReferenceInfos.Count;

                foreach (var item in findDependencyAssets.ReferenceInfos)
                {
                    EditorUtility.DisplayProgressBar("Find Reference", item.AssetPath, (float)count / size);

                    list.Add(new AssetReferenceInfo(item.AssetPath, item.ReferenceAssetBundles.ToArray()));

                    count++;
                }

                assetReferenceInfo = list.ToArray();

                EditorUtility.ClearProgressBar();
            }
            else
            {
                assetReferenceInfo = new AssetReferenceInfo[0];
            }

            dependencyScrollView          = new DependencyScrollView();
            dependencyScrollView.Contents = GetListOfDependentInfos();

            referenceScrollView          = new ReferenceScrollView();
            referenceScrollView.Contents = GetListOfReferenceInfos();

            ShowUtility();
            initialized = true;
        }