当前位置: 首页>>代码示例>>C#>>正文


C# Node.GetChildNodes方法代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:haolly,项目名称:behaviac,代码行数:20,代码来源:ExporterCpp.cs

示例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);
        }
开发者ID:haolly,项目名称:behaviac,代码行数:60,代码来源:ExporterCpp.cs

示例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);
            }
        }
开发者ID:wuzhen,项目名称:behaviac,代码行数:23,代码来源:Plugin.cs


注:本文中的Behaviac.Design.Nodes.Node.GetChildNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。