コード例 #1
0
        private void GenerateBlackBoard()
        {
            var blackBoard = new Blackboard(graphView);

            blackBoard.Add(new BlackboardSection {
                title = "Exposed Properties"
            });
            blackBoard.addItemRequested = _blackboard =>
            {
                graphView.AddPropertyToBlackboard(new ExposedProperty());
            };
            blackBoard.editTextRequested = (blackboard, element, newValue) =>
            {
                var oldPropertyName = ((BlackboardField)element).text;
                if (graphView.exposedProperties.Any(x => x.propertyName == newValue))
                {
                    EditorUtility.DisplayDialog("Error", "This property name already exists, plaese chose another one!",
                                                "OK");
                    return;
                }

                var propertyIndex = graphView.exposedProperties.FindIndex(x => x.propertyName == oldPropertyName);

                graphView.exposedProperties[propertyIndex].propertyName = newValue;

                ((BlackboardField)element).text = newValue;
            };

            graphView.blackboard = blackBoard;
            blackBoard.SetPosition(new Rect(10, 30, 200, 300));

            graphView.Add(blackBoard);
        }
コード例 #2
0
        private void LinkNodes(Port output, Port input)
        {
            var tempEdge = new Edge
            {
                output = output,
                input  = input
            };

            tempEdge?.input.Connect(tempEdge);
            tempEdge?.output.Connect(tempEdge);

            targetGraphView.Add(tempEdge);
        }