Ejemplo n.º 1
0
        public static List <string> GetCachedDataByNode(BuildTarget t, NodeData node)
        {
            switch (node.Kind)
            {
            case NodeKind.IMPORTSETTING_GUI: {
                // no cache file exists for importSetting.
                return(new List <string>());
            }

            case NodeKind.MODIFIER_GUI: {
                // no cache file exists for modifier.
                return(new List <string>());
            }

            case NodeKind.PREFABBUILDER_GUI: {
                var cachedPathBase = FileUtility.PathCombine(
                    AssetBundleGraphSettings.PREFABBUILDER_CACHE_PLACE,
                    node.Id,
                    SystemDataUtility.GetPathSafeTargetName(t)
                    );

                // no cache folder, no cache.
                if (!Directory.Exists(cachedPathBase))
                {
                    // search default platform + package
                    cachedPathBase = FileUtility.PathCombine(
                        AssetBundleGraphSettings.PREFABBUILDER_CACHE_PLACE,
                        node.Id,
                        SystemDataUtility.GetPathSafeDefaultTargetName()
                        );

                    if (!Directory.Exists(cachedPathBase))
                    {
                        return(new List <string>());
                    }
                }

                return(FileUtility.GetFilePathsInFolder(cachedPathBase));
            }

            case NodeKind.BUNDLECONFIG_GUI: {
                // do nothing.
                break;
            }

            case NodeKind.BUNDLEBUILDER_GUI: {
                var cachedPathBase = FileUtility.PathCombine(
                    AssetBundleGraphSettings.BUNDLEBUILDER_CACHE_PLACE,
                    node.Id,
                    SystemDataUtility.GetPathSafeTargetName(t)
                    );

                // no cache folder, no cache.
                if (!Directory.Exists(cachedPathBase))
                {
                    // search default platform + package
                    cachedPathBase = FileUtility.PathCombine(
                        AssetBundleGraphSettings.BUNDLEBUILDER_CACHE_PLACE,
                        node.Id,
                        SystemDataUtility.GetPathSafeDefaultTargetName()
                        );

                    if (!Directory.Exists(cachedPathBase))
                    {
                        return(new List <string>());
                    }
                }

                return(FileUtility.GetFilePathsInFolder(cachedPathBase));
            }

            default: {
                // nothing to do.
                break;
            }
            }
            return(new List <string>());
        }