コード例 #1
0
        protected override void ItemSelected(AdvancedDropdownItem item)
        {
            base.ItemSelected(item);
            if (!(item is NodeItem nodeItem))
            {
                Debug.Log("转型失败");
                return;
            }

            if (item.name == "创建Group")
            {
                new NodeGroup("Group", m_CanvasPos);
            }
            else
            {
                Node node = Node.Create(nodeItem.NodeId, m_CanvasPos, NodeEditor.curEditorState.canvas, NodeEditor.curEditorState.connectKnob);
                if (s_FromConnectionKnob != null && node.connectionKnobs.Count > 0)
                {
                    s_FromConnectionKnob.TryApplyConnection(node.connectionKnobs[0]);
                    s_FromConnectionKnob = null;
                }
            }

            NodeEditor.RepaintClients();
        }