public override void Prepare(BuildTarget target, Model.NodeData node,
                                 IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput,
                                 PerformGraph.Output Output)
    {
        if (Output != null)
        {
            var destination = connectionsToOutput == null || !connectionsToOutput.Any() ? null : connectionsToOutput.First();

            if (incoming != null)
            {
                var key        = "0";
                var outputDict = new Dictionary <string, List <AssetReference> >();
                outputDict[key] = new List <AssetReference>();
                var internalPath = string.Empty;
                foreach (var ag in incoming)
                {
                    foreach (var agAssetGroup in ag.assetGroups)
                    {
                        foreach (var assetReference in agAssetGroup.Value)
                        {
                            internalPath = assetReference.path;
                            break;
                        }

                        break;
                    }

                    break;
                }

                _manifestDirectoryInternalRelative = Path.GetDirectoryName(internalPath);
                Debug.Log("Custom manifest folder choose: " + _manifestDirectoryInternalRelative);

                var customManifest =
                    AssetReferenceDatabase.GetAssetBundleReference(GetCustomManifestPath(_manifestDirectoryInternalRelative));
                outputDict[key].Add(customManifest);

                Output(destination, outputDict);
            }
            else
            {
                Output(destination, new Dictionary <string, List <AssetReference> >());
            }
        }
        else
        {
            Debug.LogError("Output node not set!!! You need attach some node to NodeBundlesManifestCreator!!!");
        }
    }
Esempio n. 2
0
    public override void Prepare(BuildTarget target, Model.NodeData node,
                                 IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput,
                                 PerformGraph.Output Output)
    {
        if (Output != null)
        {
            var destination = connectionsToOutput == null || !connectionsToOutput.Any() ? null : connectionsToOutput.First();

            if (incoming != null)
            {
                var key        = "0";
                var outputDict = new Dictionary <string, List <AssetReference> >();
                outputDict[key] = new List <AssetReference>();
                foreach (var ag in incoming)
                {
                    foreach (var agAssetGroup in ag.assetGroups)
                    {
                        foreach (var assetReference in agAssetGroup.Value)
                        {
                            if (assetReference.extension != ".manifest" && !_ignoreList.Contains(assetReference.fileNameAndExtension))
                            {
                                var bundle = AssetReferenceDatabase.GetAssetBundleReference(assetReference.path);
                                Debug.Log(bundle.fileName);
                                outputDict[key].Add(bundle);
                            }
                        }
                    }
                }

                var customPath     = GetCustomManifestPath(target, node);
                var customManifest = AssetReferenceDatabase.GetAssetBundleManifestReference(customPath);
                outputDict[key].Add(customManifest);

                Output(destination, outputDict);
            }
            else
            {
                Output(destination, new Dictionary <string, List <AssetReference> >());
            }
        }
        else
        {
            Debug.LogError("Output node not set!!! You need attach some node to NodeBundlesManifestCreator!!!");
        }
    }
    public override void Prepare(BuildTarget target, NodeData nodeData, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <ConnectionData> connectionsToOutput,
                                 PerformGraph.Output outputFunc)
    {
        if (outputFunc != null)
        {
            ConnectionData destinationResult = null;
            ConnectionData destinationPass   = null;

            if (connectionsToOutput != null && connectionsToOutput.Count() == 2)
            {
                destinationResult = connectionsToOutput.First(data => data.FromNodeConnectionPointId == _outputPointResult.Id);
                destinationPass   = connectionsToOutput.First(data => data.FromNodeConnectionPointId == _outputPointPass.Id);
            }

            if (incoming != null)
            {
                if (destinationPass != null)
                {
                    if (incoming.First() != null)
                    {
                        outputFunc(destinationPass, incoming.First().assetGroups);
                    }
                    else
                    {
                        outputFunc(destinationPass, new Dictionary <string, List <AssetReference> >());
                    }
                }

                if (destinationResult != null)
                {
                    if (incoming.First() != null)
                    {
                        var key        = "0";
                        var outputDict = new Dictionary <string, List <AssetReference> >();
                        outputDict[key] = new List <AssetReference>();

                        foreach (var agAssetGroup in incoming.First().assetGroups)
                        {
                            foreach (var assetReference in agAssetGroup.Value)
                            {
                                if (assetReference.extension != ".manifest" && !_ignoreList.Contains(assetReference.fileNameAndExtension))
                                {
                                    var bundle = AssetReferenceDatabase.GetAssetBundleReference(assetReference.path);
                                    outputDict[key].Add(bundle);
                                }
                            }
                        }

                        if (outputDict[key].Count > 0)
                        {
                            var customManifestPath = Path.Combine(Path.GetDirectoryName(outputDict[key][0].path), _manifestFileName + ".json");
                            _manifestCachePath = AssetReferenceDatabase.GetAssetBundleReference(customManifestPath);
                            outputDict[key].Add(_manifestCachePath);
                        }

                        outputFunc(destinationResult, outputDict);
                    }
                    else
                    {
                        outputFunc(destinationResult, new Dictionary <string, List <AssetReference> >());
                    }
                }
            }
        }
    }