本文整理汇总了C#中Behaviac.Design.Nodes.Node.AcceptsAttachment方法的典型用法代码示例。如果您正苦于以下问题:C# Node.AcceptsAttachment方法的具体用法?C# Node.AcceptsAttachment怎么用?C# Node.AcceptsAttachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behaviac.Design.Nodes.Node
的用法示例。
在下文中一共展示了Node.AcceptsAttachment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: replaceNode
private bool replaceNode(Node node, Node newnode) {
if (node == null || !node.IsFSM && node.ParentConnector == null || newnode == null) {
return false;
}
bool replaced = (node.Children.Count == 0);
if (!replaced && newnode.CanAdoptChildren(node)) {
foreach(Node.Connector connector in node.Connectors) {
Node.Connector newConnector = newnode.GetConnector(connector.Identifier);
if (newConnector != null) {
for (int i = 0; i < connector.ChildCount; ++i) {
replaced |= newnode.AddChild(newConnector, (Node)connector.GetChild(i));
}
connector.ClearChildrenInternal();
}
}
}
if (replaced)
{
Node parentNode = (Node)node.Parent;
if (node.IsFSM)
{
Debug.Check(newnode.IsFSM);
parentNode.RemoveFSMNode(node);
parentNode.AddFSMNode(newnode);
newnode.ScreenLocation = node.ScreenLocation;
}
else
{
Node.Connector parentConnector = node.ParentConnector;
Debug.Check(parentConnector != null);
int index = parentConnector.GetChildIndex(node);
Debug.Check(index >= 0);
parentNode.RemoveChild(parentConnector, node);
parentNode.AddChild(parentConnector, newnode, index);
}
foreach (Attachments.Attachment attach in node.Attachments)
{
if (attach != null && newnode.AcceptsAttachment(attach))
newnode.AddAttachment(attach);
}
}
return replaced;
}