本文整理汇总了C#中Behaviac.Design.Nodes.Node.GetChildNodes方法的典型用法代码示例。如果您正苦于以下问题:C# Node.GetChildNodes方法的具体用法?C# Node.GetChildNodes怎么用?C# Node.GetChildNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behaviac.Design.Nodes.Node
的用法示例。
在下文中一共展示了Node.GetChildNodes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportNodeClass
private void ExportNodeClass(StreamWriter file, string btClassName, string agentType, BehaviorNode behavior, Node node)
{
if (!node.Enable)
return;
string nodeName = string.Format("node{0}", node.Id);
NodeCppExporter nodeExporter = NodeCppExporter.CreateInstance(node);
nodeExporter.GenerateClass(node, file, "", nodeName, agentType, btClassName);
ExportAttachmentClass(file, btClassName, node);
if (!(node is ReferencedBehavior))
{
foreach (Node child in node.GetChildNodes())
{
ExportNodeClass(file, btClassName, agentType, behavior, child);
}
}
}
示例2: ExportNode
private void ExportNode(StreamWriter file, string btClassName, string agentType, string parentName, Node node, int indentDepth)
{
if (!node.Enable)
return;
// generate the indent string
string indent = string.Empty;
for (int i = 0; i < indentDepth; ++i)
{
indent += '\t';
}
string nodeName = string.Format("node{0}", node.Id);
// open some brackets for a better formatting in the generated code
file.WriteLine("{0}{{", indent);
// export its instance and the properties
NodeCppExporter nodeExporter = NodeCppExporter.CreateInstance(node);
nodeExporter.GenerateInstance(node, file, indent, nodeName, agentType, btClassName);
ExportPars(file, agentType, nodeName, node, indent);
ExportAttachment(file, btClassName, agentType, nodeName, node, indent + "\t");
bool isAsChild = true;
if (node.Parent != null)
{
BaseNode.Connector connector = node.Parent.GetConnector(node);
if (connector != null && !connector.IsAsChild)
{
isAsChild = false;
}
}
if (isAsChild)
{
// add the node to its parent
file.WriteLine("{0}\t{1}->AddChild({2});", indent, parentName, nodeName);
}
else
{
// add the node as its customized children
file.WriteLine("{0}\t{1}->SetCustomCondition({2});", indent, parentName, nodeName);
}
// export the child nodes
if (!node.IsFSM && !(node is ReferencedBehavior))
{
foreach (Node child in node.GetChildNodes())
{
ExportNode(file, btClassName, agentType, nodeName, child, indentDepth + 1);
}
}
file.WriteLine("{0}\t{1}->SetHasEvents({1}->HasEvents() | {2}->HasEvents());", indent, parentName, nodeName);
// close the brackets for a better formatting in the generated code
file.WriteLine("{0}}}", indent);
}
示例3: CheckPar
public static void CheckPar(Node node, ParInfo par, ref List<Node.ErrorCheck> result)
{
try {
// self
checkPar(node, par, ref result);
// attachment
foreach(Attachments.Attachment attach in node.Attachments) {
checkPar(attach, par, ref result);
}
// children
foreach(BaseNode child in node.GetChildNodes()) {
if (child is Node && !(child is ReferencedBehaviorNode)) {
Node childNode = child as Node;
CheckPar(childNode, par, ref result);
}
}
} catch (Exception ex) {
MessageBox.Show(ex.Message, Resources.LoadError, MessageBoxButtons.OK);
}
}