示例#1
0
        public void Run(string nodeId, string labelToNext, Dictionary <string, List <InternalAssetData> > unused, List <string> alreadyCached, Action <string, string, Dictionary <string, List <InternalAssetData> >, List <string> > Output)
        {
            ValidateLoadPath(
                loadFilePath,
                loadFilePath,
                () => {
                throw new Exception("load path is empty.");
            },
                () => {
                throw new Exception("directory not found:" + loadFilePath);
            }
                );

            // SOMEWHERE_FULLPATH/PROJECT_FOLDER/Assets/
            var assetsFolderPath = Application.dataPath + AssetBundleGraphSettings.UNITY_FOLDER_SEPARATOR;

            var outputSource = new List <InternalAssetData>();

            try {
                var targetFilePaths = FileController.FilePathsInFolder(loadFilePath);

                foreach (var targetFilePath in targetFilePaths)
                {
                    // already contained into Assets/ folder.
                    // imported path is Assets/SOMEWHERE_FILE_EXISTS.
                    if (targetFilePath.StartsWith(assetsFolderPath))
                    {
                        var importedPath = targetFilePath.Replace(assetsFolderPath, AssetBundleGraphSettings.ASSETS_PATH);

                        outputSource.Add(
                            InternalAssetData.InternalImportedAssetDataByLoader(
                                targetFilePath,
                                loadFilePath,
                                importedPath,
                                AssetDatabase.AssetPathToGUID(importedPath),
                                AssetBundleGraphInternalFunctions.GetAssetType(importedPath)
                                )
                            );
                        continue;
                    }

                    throw new Exception("loader:" + targetFilePath + " is not imported yet, should import before bundlize.");

                    // outputSource.Add(
                    //  InternalAssetData.InternalAssetDataByLoader(
                    //      targetFilePath,
                    //      loadFilePath
                    //  )
                    // );
                }

                var outputDir = new Dictionary <string, List <InternalAssetData> > {
                    { "0", outputSource }
                };

                Output(nodeId, labelToNext, outputDir, new List <string>());
            } catch (Exception e) {
                Debug.LogError("Loader error:" + e);
            }
        }
        public void Run(string nodeName, string nodeId, string connectionIdToNextNode, Dictionary <string, List <InternalAssetData> > unused, List <string> alreadyCached, Action <string, string, Dictionary <string, List <InternalAssetData> >, List <string> > Output)
        {
            ValidateLoadPath(
                loadFilePath,
                loadFilePath,
                () => {
                //throw new AssetBundleGraphBuildException(nodeName + ": Load Path is empty.");
            },
                () => {
                throw new AssetBundleGraphBuildException(nodeName + ": Directory not found: " + loadFilePath);
            }
                );

            // SOMEWHERE_FULLPATH/PROJECT_FOLDER/Assets/
            var assetsFolderPath = Application.dataPath + AssetBundleGraphSettings.UNITY_FOLDER_SEPARATOR;

            var outputSource = new List <InternalAssetData>();

            try {
                var targetFilePaths = FileController.FilePathsInFolder(loadFilePath);

                foreach (var targetFilePath in targetFilePaths)
                {
                    if (targetFilePath.Contains(AssetBundleGraphSettings.ASSETBUNDLEGRAPH_PATH))
                    {
                        continue;
                    }

                    // already contained into Assets/ folder.
                    // imported path is Assets/SOMEWHERE_FILE_EXISTS.
                    if (targetFilePath.StartsWith(assetsFolderPath))
                    {
                        var importedPath = targetFilePath.Replace(assetsFolderPath, AssetBundleGraphSettings.ASSETS_PATH);

                        outputSource.Add(
                            InternalAssetData.InternalImportedAssetDataByLoader(
                                targetFilePath,
                                loadFilePath,
                                importedPath,
                                AssetDatabase.AssetPathToGUID(importedPath),
                                AssetBundleGraphInternalFunctions.GetAssetType(importedPath)
                                )
                            );
                        continue;
                    }

                    throw new AssetBundleGraphSetupException(nodeName + ": Invalid target file path. Path needs to be set under Assets/ :" + targetFilePath);
                }

                var outputDir = new Dictionary <string, List <InternalAssetData> > {
                    { "0", outputSource }
                };

                Output(nodeId, connectionIdToNextNode, outputDir, new List <string>());
            } catch (Exception e) {
                Debug.LogError(nodeName + " Error:" + e);
            }
        }