本文整理汇总了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);
}
}