protected override void CloneProperties(Brainiac.Design.Nodes.Node newnode) { base.CloneProperties(newnode); CompoundTask node = (CompoundTask)newnode; node._methodType = _methodType; }
public NodeViewDataCompoundTask(NodeViewData parent, BehaviorNode rootBehavior, Node node, Pen borderPen, Brush backgroundBrush, string label, string description) : base(parent, rootBehavior, node, borderPen, backgroundBrush, label, description) { Nodes.CompoundTask compoundTask = (Nodes.CompoundTask)_node; _usedMethodType = compoundTask.MethodType; // register to any method changes so our list is always up-to-date Nodes.Method.MethodWasModified += Method_MethodWasModified; }
protected override bool NeedsToSynchronizeWithNode() { if (_forceSynchronization) { return(true); } Nodes.CompoundTask compoundTask = (Nodes.CompoundTask)_node; return(compoundTask.MethodType != _usedMethodType || base.NeedsToSynchronizeWithNode()); }
public override void DoSynchronizeWithNode(ProcessedBehaviors processedBehaviors) { _forceSynchronization = false; // make all connectors changable for (int i = 0; i < _children.Connectors.Count; ++i) { _children.Connectors[i].IsReadOnly = false; } base.DoSynchronizeWithNode(processedBehaviors); // add all methods we can find Nodes.CompoundTask compoundTask = (Nodes.CompoundTask)_node; _usedMethodType = compoundTask.MethodType; if (compoundTask.MethodType.Length < 1) { return; } Connector methods = GetConnector("Methods"); Debug.Check(methods != null); List <Nodes.Method> methodList = new List <Nodes.Method>(); // collect all the methods we find IList <string> allMethods = BehaviorManager.Instance.GetAllBehaviors(); for (int i = 0; i < allMethods.Count; ++i) { Nodes.Method method = (Nodes.Method)BehaviorManager.Instance.LoadBehavior(allMethods[i]); Debug.Check(method != null); if (method != _rootBehavior && method.MethodType == compoundTask.MethodType) { methodList.Add(method); } } // sort methods by priority methodList.Sort(SortMethodsByPriority); // add methods to node foreach (Nodes.Method method in methodList) { Debug.Verify(AddChildNotModified(methods, method.CreateNodeViewData(this, _rootBehavior))); } }