예제 #1
0
 public EditorNodeElement(INode so, EditorActionNode node)
 {
     _so       = so;
     _node     = node;
     _typeInfo = NodeTypeInfo.GetNodeTypeInfo(so.GetType());
     CreateFieldElement();
 }
예제 #2
0
        public virtual void InputDraw(EditorActionNode node, ScriptableObject asset)
        {
            var nodeTypeInfo = NodeTypeInfo.GetNodeTypeInfo(asset.GetType());
            List <NodeTypeInfo.IOInfo> list = new List <NodeTypeInfo.IOInfo>();

            list.AddRange(nodeTypeInfo.Inputs);
            list.AddRange(nodeTypeInfo.BTInputs);

            foreach (var inputInfo in list)
            {
                if (inputInfo.Mode == NodeTypeInfo.IOMode.BTInput)
                {
                    Port.Capacity capacity = Port.Capacity.Single;
                    var           portIn   = node.InstantiatePort(Orientation.Vertical, Direction.Input, capacity, null);
                    portIn.portColor        = NodeTypeInfo.IOModeColor(inputInfo.Mode);
                    portIn.portName         = string.Empty;
                    portIn.source           = inputInfo;
                    portIn.style.paddingTop = 2;
                    node.titleContainer.Add(portIn);
                    node.titleContainer.style.justifyContent = Justify.FlexStart;
                    node.titleButtonContainer.style.display  = DisplayStyle.None;
                }
                else
                {
                    Port.Capacity capacity = Port.Capacity.Multi;
                    var           portIn   = node.InstantiatePort(Orientation.Horizontal, Direction.Input, capacity, null);
                    portIn.portColor = NodeTypeInfo.IOModeColor(inputInfo.Mode);
                    portIn.portName  = inputInfo.GetName();
                    portIn.source    = inputInfo;
                    node.inputContainer.Add(portIn);
                }
            }
        }
 public EditorNodeElement(SerializedProperty so, EditorActionNode node)
 {
     _so       = so;
     _node     = node;
     _typeInfo = NodeTypeInfo.GetNodeTypeInfo(so.GetValueType());
     CreateFieldElement();
 }
예제 #4
0
        public virtual void OutputDraw(EditorActionNode node, INode asset)
        {
            var nodeTypeInfo = NodeTypeInfo.GetNodeTypeInfo(asset.GetType());

            for (int i = 0; i < nodeTypeInfo.Outputs.Count; i++)
            {
                var outputInfo = nodeTypeInfo.Outputs[i];

                Port.Capacity capacity = (outputInfo.Mode == NodeTypeInfo.IOMode.BTOutput) ? Port.Capacity.Single : Port.Capacity.Multi;
                var           port     = node.InstantiatePort(Orientation.Horizontal, Direction.Output, capacity, null);
                port.portName  = outputInfo.GetName();
                port.source    = outputInfo;
                port.portColor = NodeTypeInfo.IOModeColor(outputInfo.Mode);
                node.outputContainer.Add(port);
            }
        }
예제 #5
0
        private void InputDraw(INode asset)
        {
            var nodeTypeInfo = NodeTypeInfo.GetNodeTypeInfo(asset.GetType());
            var list         = new List <NodeTypeInfo.IOInfo>();

            list.AddRange(nodeTypeInfo.Inputs);
            list.AddRange(nodeTypeInfo.BTInputs);

            foreach (var inputInfo in list)
            {
                var capacity = inputInfo.Mode == NodeTypeInfo.IOMode.BTInput? Port.Capacity.Single:Port.Capacity.Multi;
                var portIn   = InstantiatePort(Orientation.Horizontal, Direction.Input, capacity, null);
                portIn.portColor = NodeTypeInfo.IOModeColor(inputInfo.Mode);
                portIn.portName  = inputInfo.GetName();
                portIn.source    = inputInfo;
                inputContainer.Add(portIn);
            }
        }
예제 #6
0
        private void OutputDraw(INode asset)
        {
            var nodeTypeInfo = NodeTypeInfo.GetNodeTypeInfo(asset.GetType());

            foreach (var outputInfo in nodeTypeInfo.Outputs)
            {
                var capacity = outputInfo.Mode == NodeTypeInfo.IOMode.BTOutput ? Port.Capacity.Single : Port.Capacity.Multi;
                var port     = InstantiatePort(Orientation.Horizontal, Direction.Output, capacity, null);
                port.portName  = outputInfo.GetName();
                port.source    = outputInfo;
                port.portColor = NodeTypeInfo.IOModeColor(outputInfo.Mode);
                outputContainer.Add(port);
            }

            if (nodeTypeInfo.BTOutput != null)
            {
                var count = Math.Min(nodeTypeInfo.BTOutput.MaxLink, 20);
                for (var i = 0; i < count; i++)
                {
                    var capacity = Port.Capacity.Single;
                    var port     = InstantiatePort(Orientation.Horizontal, Direction.Output, capacity, null);
                    if (count > 1)
                    {
                        port.AddToClassList("small-port");
                    }

                    port.portName = i.ToString();
                    var newIOInfo = nodeTypeInfo.BTOutput.IOInfo.Clone();
                    newIOInfo.ID  += i;
                    port.source    = newIOInfo;
                    port.portColor = NodeTypeInfo.IOModeColor(NodeTypeInfo.IOMode.BTOutput);

                    outputContainer.Add(port);
                }
            }
        }