示例#1
0
 public OnNodeEvent(EventType type, Node node, Vector2 localMousePos, ConnectionPoint conPoint)
 {
     this.eventType = type;
     this.eventSourceNode = node;
     this.eventSourceConnectionPoint = conPoint;
     this.globalMousePosition = new Vector2(localMousePos.x + node.GetX(), localMousePos.y + node.GetY());
 }
示例#2
0
        public void DuplicateNode(Node node)
        {
            var newNode = node.DuplicatedNode(
                nodes.Count,
                node.GetX() + 10f,
                node.GetY() + 10f
            );

            switch (newNode.kind) {
                case AssetBundleGraphSettings.NodeKind.LOADER_GUI: {
                    newNode.AddConnectionPoint(new OutputPoint(AssetBundleGraphSettings.DEFAULT_OUTPUTPOINT_LABEL));
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.FILTER_GUI: {
                    newNode.AddConnectionPoint(new InputPoint(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL));
                    foreach (var outputPointLabel in newNode.filterContainsKeywords) {
                        newNode.AddConnectionPoint(new OutputPoint(outputPointLabel));
                    }
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.IMPORTSETTING_GUI: {
                    newNode.AddConnectionPoint(new InputPoint(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL));
                    newNode.AddConnectionPoint(new OutputPoint(AssetBundleGraphSettings.DEFAULT_OUTPUTPOINT_LABEL));
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.MODIFIER_GUI: {
                    newNode.AddConnectionPoint(new InputPoint(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL));
                    newNode.AddConnectionPoint(new OutputPoint(AssetBundleGraphSettings.DEFAULT_OUTPUTPOINT_LABEL));
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.GROUPING_GUI: {
                    newNode.AddConnectionPoint(new InputPoint(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL));
                    newNode.AddConnectionPoint(new OutputPoint(AssetBundleGraphSettings.DEFAULT_OUTPUTPOINT_LABEL));
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.PREFABRICATOR_GUI:{
                    newNode.AddConnectionPoint(new InputPoint(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL));
                    newNode.AddConnectionPoint(new OutputPoint(AssetBundleGraphSettings.DEFAULT_OUTPUTPOINT_LABEL));
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.BUNDLIZER_GUI: {
                    newNode.AddConnectionPoint(new InputPoint(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL));
                    newNode.AddConnectionPoint(new OutputPoint(AssetBundleGraphSettings.DEFAULT_OUTPUTPOINT_LABEL));
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.BUNDLEBUILDER_GUI: {
                    newNode.AddConnectionPoint(new InputPoint(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL));
                    newNode.AddConnectionPoint(new OutputPoint(AssetBundleGraphSettings.BUNDLIZER_BUNDLE_OUTPUTPOINT_LABEL));
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.EXPORTER_GUI: {
                    newNode.AddConnectionPoint(new InputPoint(AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL));
                    break;
                }
                default: {
                    Debug.LogError("no kind match:" + newNode.kind);
                    break;
                }
            }

            nodes.Add(newNode);
        }
示例#3
0
        private static Dictionary<string, object> JsonRepresentationDict(Node node)
        {
            var nodeDict = new Dictionary<string, object>();

            nodeDict[AssetBundleGraphSettings.NODE_NAME] = node.name;
            nodeDict[AssetBundleGraphSettings.NODE_ID] = node.nodeId;
            nodeDict[AssetBundleGraphSettings.NODE_KIND] = node.kind.ToString();

            var outputLabels = node.OutputPointLabels();
            nodeDict[AssetBundleGraphSettings.NODE_OUTPUT_LABELS] = outputLabels;

            var posDict = new Dictionary<string, object>();
            posDict[AssetBundleGraphSettings.NODE_POS_X] = node.GetX();
            posDict[AssetBundleGraphSettings.NODE_POS_Y] = node.GetY();

            nodeDict[AssetBundleGraphSettings.NODE_POS] = posDict;

            switch (node.kind) {
                case AssetBundleGraphSettings.NodeKind.LOADER_GUI: {
                    nodeDict[AssetBundleGraphSettings.NODE_LOADER_LOAD_PATH] = node.loadPath.ReadonlyDict();
                    break;
                }
                case AssetBundleGraphSettings.NodeKind.EXPORTER_GUI: {
                    nodeDict[AssetBundleGraphSettings.NODE_EXPORTER_EXPORT_PATH] = node.exportPath.ReadonlyDict();
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.FILTER_SCRIPT:
                case AssetBundleGraphSettings.NodeKind.PREFABRICATOR_SCRIPT: {
                    nodeDict[AssetBundleGraphSettings.NODE_SCRIPT_TYPE] = node.scriptType;
                    nodeDict[AssetBundleGraphSettings.NODE_SCRIPT_PATH] = node.scriptPath;
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.FILTER_GUI: {
                    nodeDict[AssetBundleGraphSettings.NODE_FILTER_CONTAINS_KEYWORDS] = node.filterContainsKeywords;
                    nodeDict[AssetBundleGraphSettings.NODE_FILTER_CONTAINS_KEYTYPES] = node.filterContainsKeytypes;
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.IMPORTSETTING_GUI: {
                    nodeDict[AssetBundleGraphSettings.NODE_IMPORTER_PACKAGES] = node.importerPackages.ReadonlyDict();
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.MODIFIER_GUI: {
                    nodeDict[AssetBundleGraphSettings.NODE_MODIFIER_PACKAGES] = node.modifierPackages.ReadonlyDict();
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.GROUPING_GUI: {
                    nodeDict[AssetBundleGraphSettings.NODE_GROUPING_KEYWORD] = node.groupingKeyword.ReadonlyDict();
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.PREFABRICATOR_GUI: {
                    nodeDict[AssetBundleGraphSettings.NODE_SCRIPT_TYPE] = node.scriptType;
                    nodeDict[AssetBundleGraphSettings.NODE_SCRIPT_PATH] = node.scriptPath;
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.BUNDLIZER_GUI: {
                    nodeDict[AssetBundleGraphSettings.NODE_BUNDLIZER_BUNDLENAME_TEMPLATE] = node.bundleNameTemplate.ReadonlyDict();
                    nodeDict[AssetBundleGraphSettings.NODE_BUNDLIZER_USE_OUTPUT] = node.bundleUseOutput.ReadonlyDict();
                    break;
                }

                case AssetBundleGraphSettings.NodeKind.BUNDLEBUILDER_GUI: {
                    nodeDict[AssetBundleGraphSettings.NODE_BUNDLEBUILDER_ENABLEDBUNDLEOPTIONS] = node.enabledBundleOptions.ReadonlyDict();
                    break;
                }

                default: {
                    Debug.LogError("failed to match:" + node.kind);
                    break;
                }
            }
            return nodeDict;
        }