Beispiel #1
0
        void OnEnable()
        {
            if (browserState == null)
            {
                browserState = new BrowserState();
            }

            browser     = new NodeBrowser(browserState);
            searchField = new SearchField();
            searchField.downOrUpArrowKeyPressed += browser.SetFocusAndEnsureSelectedItem;
            wantsMouseEnterLeaveWindow           = true;
        }
        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);
            }
                );
        }
Beispiel #3
0
 public MemberTreeView(MemberInfo member, int id, int depth) : base(id, depth, NodeBrowser.GetRichMemberName(member))
 {
     this.member = member;
 }
Beispiel #4
0
 public MemberTreeView(MemberInfo member) : base(member.GetHashCode(), -1, NodeBrowser.GetRichMemberName(member))
 {
     this.member = member;
 }