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))); } }
protected static int SortMethodsByPriority(Nodes.Method a, Nodes.Method b) { if (a.Priority > b.Priority) { return(1); } if (a.Priority < b.Priority) { return(-1); } return(0); }
void Method_MethodWasModified(Nodes.Method method) { _forceSynchronization = true; }