Beispiel #1
0
        private static Offset <NodeInputFieldInfo> ConvertToRuntimeInputPortInfo(FlatBufferBuilder fbb, InputPortEditorView inputPortView)
        {
            InputPortReflectionInfo inputPortReflectionInfo = inputPortView.inputPortReflectionInfo;

            StringOffset fieldNameOffset =
                fbb.CreateString(inputPortView.inputPortReflectionInfo.nodeInputVariableFieldInfo.Name);
            StringOffset inputValueTypeName = fbb.CreateString(inputPortReflectionInfo.inputValueType.FullName);

            if (inputPortView.connectedPortList.Count > 0)
            {
                NodeInputFieldInfo.StartNodeInputFieldInfo(fbb);
                NodeInputFieldInfo.AddTargetNodeId(fbb, inputPortView.connectedPortList[0].NodeView.NodeId);
                NodeInputFieldInfo.AddTargetPortId(fbb, inputPortView.connectedPortList[0].portId);
            }
            else
            {
                StringOffset inputValueString = fbb.CreateString(inputPortReflectionInfo.GetNodeVariableValueString());

                NodeInputFieldInfo.StartNodeInputFieldInfo(fbb);
                NodeInputFieldInfo.AddTargetNodeId(fbb, -1);
                NodeInputFieldInfo.AddTargetPortId(fbb, -1);
                NodeInputFieldInfo.AddValueString(fbb, inputValueString);
            }

            NodeInputFieldInfo.AddValueTypeName(fbb, inputValueTypeName);
            NodeInputFieldInfo.AddFieldName(fbb, fieldNameOffset);
            return(NodeInputFieldInfo.EndNodeInputFieldInfo(fbb));
        }
Beispiel #2
0
        private static InputPortConfigInfo ConvertToInputPortInfo(InputPortEditorView inputPort)
        {
            InputPortConfigInfo inputPortConfigInfo = new InputPortConfigInfo();

            InputPortReflectionInfo inputPortReflectionInfo = inputPort.inputPortReflectionInfo;

            inputPortConfigInfo.portName = inputPortReflectionInfo.inputPortAttribute.portName;

            if (inputPort.connectedPortList.Count > 0)
            {
                inputPortConfigInfo.targetNodeId = inputPort.connectedPortList[0].NodeView.NodeId;
                OutputPortEditorView outputPortView = inputPort.connectedPortList[0] as OutputPortEditorView;
                if (outputPortView == null)
                {
                    Debug.LogErrorFormat("节点{0}的input端口{1} 连接的接口类型不是OutputPortEditorView", inputPort.NodeView.NodeId,
                                         inputPort.portId);
                    return(null);
                }

                inputPortConfigInfo.targetPortName = outputPortView.outputPortReflectionInfo.PortName;
            }
            else
            {
                inputPortConfigInfo.targetNodeId   = -1;
                inputPortConfigInfo.targetPortName = string.Empty;

                inputPortConfigInfo.nodeVariableGenericTypeName = inputPortReflectionInfo.inputValueType.FullName;
                inputPortConfigInfo.nodeVariableValue           = inputPortReflectionInfo.GetNodeVariableValueString();
            }

            return(inputPortConfigInfo);
        }