コード例 #1
0
        public void CreateNewQualifierNode(Vector2 position)
        {
            QualifierData qData = new QualifierData();

            qData.position   = position;
            qData.guid       = Guid.NewGuid().ToString();
            qData.actionName = graphData.context.actionNames[0];
            graphData.qualifiers.Add(qData);
            SaveGraphData();
            int           qIndex = graphData.qualifiers.Count - 1;
            QualifierNode qNode  = CreateQualifierNode(qIndex);

            AddNewQualifierPort(qNode, qIndex);
        }
コード例 #2
0
        private void AddExistingQualifierPort(QualifierNode qNode, int qIndex, int nwIndex)
        {
            NodeWeightedLink nwLink = graphData.qualifiers[qIndex].inLinks[nwIndex];

            SaveGraphData();
            SerializedProperty serNWL = graphDataSerialized
                                        .FindProperty("qualifiers")
                                        .GetArrayElementAtIndex(qIndex)
                                        .FindPropertyRelative("inLinks")
                                        .GetArrayElementAtIndex(nwIndex)
                                        .FindPropertyRelative("weight");
            Port port = qNode.AddInputPort(nwLink, serNWL);

            AddExistingPort(nwLink, port, qNode);
        }
コード例 #3
0
        public QualifierNode CreateQualifierNode(int index)
        {
            QualifierData      qData   = graphData.qualifiers[index];
            SerializedProperty qArr    = graphDataSerialized.FindProperty("qualifiers");
            SerializedProperty serData = qArr.GetArrayElementAtIndex(index);
            QualifierNode      node    = new QualifierNode(qData, graphData.context.actionNames, serData);

            this.AddElement(node);
            for (int i = 0; i < qData.inLinks.Count; i++)
            {
                AddExistingQualifierPort(node, index, i);
            }
            this.allNodes.Add(node.guid, node);
            qualifierNodes.Add(node);
            return(node);
        }
コード例 #4
0
        private void AddNewQualifierPort(QualifierNode qNode, int qIndex)
        {
            NodeWeightedLink nwLink = new NodeWeightedLink();

            nwLink.otherNodeID = "";
            nwLink.weight      = 0.5f;
            graphData.qualifiers[qIndex].inLinks.Add(nwLink);
            int linkIndex = graphData.qualifiers[qIndex].inLinks.Count - 1;

            SaveGraphData();
            SerializedProperty serNWL = graphDataSerialized
                                        .FindProperty("qualifiers")
                                        .GetArrayElementAtIndex(qIndex)
                                        .FindPropertyRelative("inLinks")
                                        .GetArrayElementAtIndex(linkIndex)
                                        .FindPropertyRelative("weight");

            qNode.AddInputPort(nwLink, serNWL);
        }
コード例 #5
0
 private void DeleteEdge(Edge edge)
 {
     if (edge.input.node is QualiScorerNode)
     {
         QualiScorerNode qsNode    = ((QualiScorerNode)edge.input.node);
         NodeData        nData     = GetDataByGuid(qsNode.guid);
         QualiScorerData qData     = (QualiScorerData)nData;
         int             portIndex = qsNode.inputContainer.IndexOf(edge.input);
         qData.inLinks[portIndex].otherNodeID = "";
         SaveGraphData();
     }
     else if (edge.input.node is QualifierNode)
     {
         QualifierNode qNode     = ((QualifierNode)edge.input.node);
         NodeData      nData     = GetDataByGuid(qNode.guid);
         QualifierData qData     = (QualifierData)nData;
         int           portIndex = qNode.inputContainer.IndexOf(edge.input);
         qData.inLinks[portIndex].otherNodeID = "";
         SaveGraphData();
     }
 }