private List <NodeFieldDesc> _GetNodeOutPutEnvKeyList(NodeProto nodeProto, NodeProto inputNode, NodeFieldDesc desc = null) { if (nodeProto.nodeId >= inputNode.nodeId) { return(new List <NodeFieldDesc>()); } List <NodeFieldDesc> list = new List <NodeFieldDesc>(); if (desc == null) { list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof(NodeOutputAttribute)); } else { list = ExportNodeTypeConfig.GetNodeFieldInOutPutFilterDescList(nodeProto.name, typeof(NodeOutputAttribute), desc.envKeyType); } for (int i = 0; i < list.Count; i++) { object value = nodeProto.args_dict.GetTreeDictValue(list[i].type, list[i].name); list[i].value = value; } foreach (NodeProto childProto in nodeProto.children) { list.AddRange(_GetNodeOutPutEnvKeyList(childProto, inputNode, desc)); } return(list); }
private List <NodeFieldDesc> GetFieldDescList(NodeProto nodeProto, Type type) { List <NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, type); foreach (NodeProto childProto in nodeProto.children) { list.AddRange(GetFieldDescList(childProto, type)); } return(list); }
public bool IsHighLight(BehaviorNodeData node) { NodeProto nodeProto = NodeDataToNodeProto(node); List <NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof(NodeOutputAttribute)); foreach (var desc in list) { if (!nodeProto.args_dict.ContainsKey(desc.name)) { continue; } string value = nodeProto.args_dict.GetTreeDictValue(desc.type, desc.name)?.ToString(); List <string> resultList = inputValueList.FindAll(str => { return(str == value); }); if (resultList.Count > 0) { return(true); } } return(false); }
public List <string> GetSelectNodeInputValueList(NodeProto nodeProto) { List <string> resultList = new List <string>(); List <NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof(NodeInputAttribute)); foreach (var desc in list) { if (!nodeProto.args_dict.ContainsKey(desc.name)) { ValueBase valueBase = new ValueBase(); nodeProto.args_dict.Add(desc.name, valueBase); } if (string.IsNullOrEmpty(nodeProto.args_dict[desc.name].enumValue)) { nodeProto.args_dict[desc.name].enumValue = BTEnvKey.None; } string value = nodeProto.args_dict.GetTreeDictValue(desc.type, desc.name)?.ToString(); resultList.Add(value); } return(resultList); }
public bool CheckNodeInput(NodeProto nodeProto) { List <NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof(NodeInputAttribute)); foreach (var desc in list) { List <string> canInputList = GetCanInPutEnvKeyList(NodeProtoToNodeData(nodeProto), desc); string value = nodeProto.args_dict.GetTreeDictValue(desc.type, desc.name)?.ToString(); List <string> resultList = canInputList.FindAll(str => { return(str == value); }); if (resultList.Count == 0) { Log.Error($"{nodeProto.name}节点(id:{nodeProto.nodeId})的{value}输入值非法!"); return(false); } } foreach (var child in nodeProto.children) { if (!CheckNodeInput(child)) { return(false); } } return(true); }