Exemplo n.º 1
0
        public override void InitializeNode(EdgeConnectorListener edgeConnectorListener)
        {
            base.InitializeNode(edgeConnectorListener);
            Initialize("Self", EditorView.DefaultNodePosition);

            lineLabel = new Label {
                name = "lineTitle", text = "Lines"
            };
            outputContainer.Add(lineLabel);

            var button = new Button(() => AddConversationPort(true))
            {
                text = "Create Dialogue Line"
            };

            extensionContainer.Add(button);
            var titleLabel   = this.Q <Label>("title-label");
            var titleElement = this.Q("title");
            var titleC       = UIElementsFactory.VisualElement <VisualElement>("title-container", null);

            titleLabel.RemoveFromHierarchy();
            titleC.Add(titleLabel);
            titleElement.Insert(0, titleC);

            var branchPort = DlogPort.Create("Branch", Orientation.Horizontal, Direction.Input, Port.Capacity.Multi, PortType.Branch, true, edgeConnectorListener);

            branchPort.AddToClassList("square-circle");
            titleC.Insert(0, branchPort);
            AddPort(branchPort, false);
            Refresh();
        }
Exemplo n.º 2
0
        public void BuildNode(EditorView editorView, EdgeConnectorListener edgeConnectorListener, bool buildPortData = true)
        {
            EditorView = editorView;
            Node       = (AbstractNode)Activator.CreateInstance(System.Type.GetType(Type));
            Node.InitializeNode(edgeConnectorListener);
            Node.GUID        = GUID;
            Node.viewDataKey = GUID;
            Node.Owner       = this;
            Node.SetExpandedWithoutNotify(DrawState.Expanded);
            Node.SetPosition(DrawState.Position);
            if (!string.IsNullOrEmpty(NodeData))
            {
                Node.SetNodeData(NodeData);
            }
            Node.Refresh();

            if (buildPortData)
            {
                BuildPortData();
            }
        }
Exemplo n.º 3
0
        public static DlogPort Create(string name, Orientation portOrientation, Direction portDirection, Capacity portCapacity, PortType type, bool required, EdgeConnectorListener edgeConnectorListener, bool hideLabel = false)
        {
            var port = new DlogPort(portOrientation, portDirection, portCapacity);

            if (edgeConnectorListener != null)
            {
                port.m_EdgeConnector = new EdgeConnector <Edge>(edgeConnectorListener);
                port.AddManipulator(port.m_EdgeConnector);
            }

            port.AddStyleSheet("Styles/Node/Port");
            if (!required)
            {
                port.AddToClassList("optional");
            }

            port.type        = type;
            port.portColor   = PortHelper.PortColor(port);
            port.viewDataKey = Guid.NewGuid().ToString();
            port.portName    = name;

            if (hideLabel)
            {
                var label = port.Q <Label>();
                var fs    = label.style.fontSize;
                fs.value             = -1;
                label.style.fontSize = fs;
                var color = label.style.color;
                color.value       = Color.clear;
                label.style.color = color;
            }


            port.InjectCustomStyle();

            return(port);
        }