コード例 #1
0
        private void CreateNodes()
        {
            foreach (Node node in repository.DeserializeNodes())
            {
                graphView.AddNodeView(node.editorPos, node);
            }

            var nodes = Nodes;

            foreach (var n in nodes)
            {
                n.Deserialize(nodes, graphView);
            }

            foreach (DataExNode dataExNode in repository.DeserializeDataExNodes())
            {
                if (dataExNode is GroupDataExNode groupData)
                {
                    graphView.AddGroup(groupData.GroupName, groupData.GroupPosition).Deserialize(groupData, nodes);
                }
            }
        }
コード例 #2
0
        public bool OnSelectEntry(SearchTreeEntry searchTreeEntry, SearchWindowContext context)
        {
            Vector2 pos = editor.rootVisualElement.ChangeCoordinatesTo(editor.rootVisualElement.parent, context.screenMousePosition
                                                                       - editor.position.position);

            pos = graphView.contentViewContainer.WorldToLocal(pos);

            if (searchTreeEntry.userData is Type type)
            {
                if (type.IsSubclassOf(typeof(BehaviourT.Node)))
                {
                    graphView.AddNodeView(pos, type);
                    return(true);
                }
                else if (type.Equals(typeof(GroupDataExNode)))
                {
                    graphView.AddGroup(pos);
                    return(true);
                }
            }

            return(false);
        }