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


C# Node.CreateNodeViewData方法代码示例

本文整理汇总了C#中Behaviac.Design.Nodes.Node.CreateNodeViewData方法的典型用法代码示例。如果您正苦于以下问题:C# Node.CreateNodeViewData方法的具体用法?C# Node.CreateNodeViewData怎么用?C# Node.CreateNodeViewData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Behaviac.Design.Nodes.Node的用法示例。


在下文中一共展示了Node.CreateNodeViewData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateReferencedBehaviorsTree

        /// <summary>
        /// Adds nodes to the referenced behaviour which represent sub-referenced behaviours.
        /// </summary>
        /// <param name="processedBehaviors">A list of processed behaviours to handle circular references.</param>
        /// <param name="parent">The node the sub-referenced behaviours will be added to.</param>
        /// <param name="node">The current node we are checking.</param>
        protected void GenerateReferencedBehaviorsTree(ProcessedBehaviors processedBehaviors, NodeViewData parent, Node node) {
            if (!processedBehaviors.MayProcess(node))
            { return; }

            // check if this is a referenced behaviour
            if (node is ReferencedBehaviorNode) {
                // create the dummy node and add it without marking the behaviour as being modified as these are no REAL nodes.
                NodeViewData rb = node.CreateNodeViewData(parent, _rootBehavior);

#if DEBUG
                rb.IsSubreferencedGraphNode();
#endif
                rb.DoSynchronizeWithNode(processedBehaviors);

                Connector conn = parent.GetConnector(Connector.kGeneric);
                Debug.Check(conn != null);

                Connector rbconn = parent.GetConnector(Connector.kGeneric);
                Debug.Check(rbconn != null);

                bool parentReadOnly = conn.IsReadOnly;

                conn.IsReadOnly = false;

                parent.AddChildNotModified(conn, rb);

                conn.IsReadOnly = parentReadOnly;

                // we have a circular reference here. Skip the children
                if (((ReferencedBehaviorNode)node).Reference == _rootBehavior) {
                    rbconn.IsReadOnly = true;
                    return;
                }

                // do the same for all the children
                foreach(Node child in node.Children)
                GenerateReferencedBehaviorsTree(processedBehaviors.Branch(child), rb, child);

                rbconn.IsReadOnly = true;

            } else if (node is Impulse) {
                // create the dummy node and add it without marking the behaviour as being modified as these are no REAL nodes.
                NodeViewData ip = node.CreateNodeViewData(parent, _rootBehavior);

                ip.DoSynchronizeWithNode(processedBehaviors);

                // do the same for all the children
                foreach(Node child in node.Children)
                GenerateReferencedBehaviorsTree(processedBehaviors.Branch(child), ip, child);

                if (ip.Children.Count > 0) {
                    Connector conn = parent.GetConnector(Connector.kGeneric);
                    Debug.Check(conn != null);

                    Connector ipconn = ip.GetConnector(Connector.kGeneric);
                    Debug.Check(ipconn != null);

                    parent.AddChildNotModified(conn, ip);

                    ipconn.IsReadOnly = true;
                }

            } else {
                // do the same for all the children
                foreach(Node child in node.Children)
                GenerateReferencedBehaviorsTree(processedBehaviors.Branch(child), parent, child);
            }
        }
开发者ID:675492062,项目名称:behaviac,代码行数:74,代码来源:NodeViewDataReferencedBehavior.cs


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