Exemplo n.º 1
0
        protected void DrawOverrideMembers(string label = "Override Members")
        {
            Type type = graphInheritFrom.Get <Type>();

            if (type == null)
            {
                return;
            }
            VariableEditorUtility.DrawCustomList(
                graphOverrideMembers,
                label,
                drawElement: (position, index, element) => {
                EditorGUI.LabelField(position, NodeBrowser.GetRichMemberName(element));
            },
                addAction: (pos) => {
                var members      = EditorReflectionUtility.GetOverrideMembers(type);
                GenericMenu menu = new GenericMenu();
                for (int i = 0; i < members.Count; i++)
                {
                    var member = members[i];
                    if (member is PropertyInfo)
                    {
                        menu.AddItem(new GUIContent("Properties/" + NodeBrowser.GetRichMemberName(member)), graphOverrideMembers.Contains(member), () => {
                            graphOverrideMembers.Add(member);
                        });
                    }
                    else
                    {
                        menu.AddItem(new GUIContent("Methods/" + NodeBrowser.GetRichMemberName(member)), graphOverrideMembers.Contains(member), () => {
                            graphOverrideMembers.Add(member);
                        });
                    }
                }
                menu.ShowAsContext();
            },
                removeAction: (index) => {
                graphOverrideMembers.RemoveAt(index);
            }
                );
        }