本文整理汇总了C#中Behaviac.Design.Nodes.Node.AddAttachment方法的典型用法代码示例。如果您正苦于以下问题:C# Node.AddAttachment方法的具体用法?C# Node.AddAttachment怎么用?C# Node.AddAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behaviac.Design.Nodes.Node
的用法示例。
在下文中一共展示了Node.AddAttachment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloneProperties
/// <summary>
/// Used to duplicate all properties. Any property added must be duplicated here as well.
/// </summary>
/// <param name="newnode">The new node which is supposed to get a copy of the properties.</param>
protected virtual void CloneProperties(Node newnode) {
Debug.Check(newnode != null);
// clone properties
newnode.ScreenLocation = this.ScreenLocation;
newnode.Id = this.Id;
newnode.Enable = this.Enable;
if (this.CommentObject != null) {
newnode.CommentObject = this.CommentObject.Clone();
}
checkPrefabFile();
newnode.PrefabName = this.PrefabName;
newnode.PrefabNodeId = this.PrefabNodeId;
newnode.HasOwnPrefabData = this.HasOwnPrefabData;
// clone pars.
if (this is Behavior) {
Behavior bnew = newnode as Behavior;
bnew.LocalVars.Clear();
foreach(ParInfo par in((Behavior)this).LocalVars) {
bnew.LocalVars.Add(par.Clone(bnew));
}
}
// clone attachements
newnode.Attachments.Clear();
foreach(Attachments.Attachment attach in _attachments) {
newnode.AddAttachment(attach.Clone(newnode));
}
}
示例2: CloneProperties
/// <summary>
/// Used to duplicate all properties. Any property added must be duplicated here as well.
/// </summary>
/// <param name="newnode">The new node which is supposed to get a copy of the properties.</param>
protected virtual void CloneProperties(Node newnode)
{
Debug.Check(newnode != null);
// clone properties
newnode.Version = this.Version;
newnode.Id = this.Id;
newnode.Enable = this.Enable;
newnode.WasModified = this.WasModified;
if (this.CommentObject != null)
{
newnode.CommentObject = this.CommentObject.Clone();
}
checkPrefabFile();
newnode.PrefabName = this.PrefabName;
newnode.PrefabNodeId = this.PrefabNodeId;
newnode.HasOwnPrefabData = this.HasOwnPrefabData;
if (this.EnterAction != null)
{
newnode.EnterAction = (MethodDef)this.EnterAction.Clone();
}
if (this.ExitAction != null)
{
newnode.ExitAction = (MethodDef)this.ExitAction.Clone();
}
// clone pars.
newnode.Pars.Clear();
foreach (ParInfo par in this.Pars)
{
newnode.Pars.Add(par.Clone(newnode));
}
// clone attachements
newnode.Attachments.Clear();
foreach (Attachments.Attachment attach in _attachments)
{
newnode.AddAttachment(attach.Clone(newnode));
}
}
示例3: 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;
}
示例4: AutoRestruct
//.........这里部分代码省略.........
else
{
oldOne.AddChild(BaseNode.Connector.kGeneric, newNode);
}
}
else if (oldOne.GetType().IsSubclassOf(typeof(Condition)))
{
AddAfterConditions(node, binaryOpr, newNode, connector, oldOne);
}
else
{
Debug.Check(false);
}
}
}
else
{
//the first condition
Behaviac.Design.Nodes.Node notNode = null;
if (bIsSeqSel)
{
//for sequence/selector, it is reverted
Type notType = Plugin.GetType("PluginBehaviac.Nodes.DecoratorNot");
notNode = Behaviac.Design.Nodes.Node.Create(notType);
node.AddChild(BaseNode.Connector.kInterupt, notNode);
notNode.AddChild(BaseNode.Connector.kGeneric, newNode);
}
else
{
node.AddChild(BaseNode.Connector.kInterupt, newNode);
}
}
// initialise the attachments properties
IList<DesignerPropertyInfo> lp = newNode.GetDesignerProperties();
for (int p = 0; p < lp.Count; ++p)
{
if (lp[p].Property.Name == "Opl")
{
lp[p].Property.SetValue(newNode, opl, null);
}
else if (lp[p].Property.Name == "Opr")
{
lp[p].Property.SetValue(newNode, opr, null);
}
else if (lp[p].Property.Name == "Operator")
{
lp[p].Property.SetValue(newNode, oprr, null);
}
}
// update attacheent with attributes
newNode.OnPropertyValueChanged(false);
}
else if (clss == "PluginBehaviac.Nodes.Action")
{
Type newType = Plugin.GetType("PluginBehaviac.Events.Precondition");
Behaviac.Design.Attachments.Attachment newNode = Behaviac.Design.Attachments.Attachment.Create(newType, node);
node.AddAttachment(newNode);
node.RemoveAttachment(a);
node.Behavior.TriggerWasModified(node);
// initialise the attachments properties
IList<DesignerPropertyInfo> lp = newNode.GetDesignerProperties();
for (int p = 0; p < lp.Count; ++p)
{
if (lp[p].Property.Name == "BinaryOperator")
{
lp[p].Property.SetValue(newNode, binaryOpr, null);
}
else if (lp[p].Property.Name == "Opl")
{
lp[p].Property.SetValue(newNode, opl, null);
}
else if (lp[p].Property.Name == "Opr2")
{
lp[p].Property.SetValue(newNode, opr, null);
}
else if (lp[p].Property.Name == "Operator")
{
lp[p].Property.SetValue(newNode, oprType, null);
}
else if (lp[p].Property.Name == "IsAlive")
{
lp[p].SetValueFromString(result, newNode, "true");
}
}
// update attacheent with attributes
newNode.OnPropertyValueChanged(false);
}
else
{
Debug.Check(false);
}
}
} // if (version <= 1)
}