示例#1
0
        private void PopulateDecoratorNodes(GenericMenu menu, BonsaiNode node)
        {
            var decorators = BonsaiEditor.RegisteredBehaviourNodeTypes.Where(t => t.IsSubclassOf(typeof(BTAuxiliary)) && !t.IsAbstract);

            foreach (var subclass in decorators)
            {
                menu.AddItem(new GUIContent("Decorator/" + subclass.Name), false, () =>
                {
                    CreateNodeRequest?.Invoke("Decorator", subclass);
                    TypeChanged?.Invoke(this, node);
                });
            }
        }
 /// <summary>
 /// The callback to create the node via typename.
 /// </summary>
 /// <param name="o">The typename as a string.</param>
 private void OnCreateNodeRequest(object o)
 {
     CreateNodeRequest?.Invoke(this, o as Type);
 }