Ejemplo n.º 1
0
    void DrawButton()
    {
        Type type = target.GetType();

        MethodInfo[] ms = type.GetMethods();
        foreach (var item in ms)
        {
            InspectorPlus.Button att_button = ReflecTool.GetAttribute <InspectorPlus.Button>(item);
            if (att_button != null)
            {
                if (att_button.Playing && Application.isPlaying)
                {
                }
                else if (att_button.Editor && !Application.isPlaying)
                {
                }
                else
                {
                    OnGUIUtility.Vision.GUIEnabled(false);
                }
                Button(item, att_button);

                OnGUIUtility.Vision.GUIEnabled(true);
            }
        }
    }
Ejemplo n.º 2
0
        protected override TreeViewItem BuildRoot()
        {
            var root = new SeanLibIndexItem {
                id = 0, depth = -1, displayName = "SeanLib"
            };
            List <List <SeanLibIndexItem> > Map = new List <List <SeanLibIndexItem> >();
            int id = 1;

            foreach (var editor in editors)
            {
                CustomSeanLibEditor att    = ReflecTool.GetAttribute <CustomSeanLibEditor>(editor.GetType());
                string[]            pathes = att.Path.Split('/');
                if (Map.Count < pathes.Length)
                {
                    int c = pathes.Length - Map.Count;
                    for (int i = 0; i < c; i++)
                    {
                        Map.Add(new List <SeanLibIndexItem>());
                    }
                }
                SeanLibIndexItem parent = root;
                for (int i = 0; i < pathes.Length; i++)
                {
                    string node      = pathes[i];
                    var    existItem = Map[i].Find(e => e.displayName == node && e.parent == parent);
                    if (existItem == null)
                    {
                        existItem = new SeanLibIndexItem {
                            id = id++, displayName = node
                        };
                        Map[i].Add(existItem);
                        if (i == 0)
                        {
                            root.AddChild(existItem);
                        }
                        else
                        {
                            var parentItem = Map[i - 1].Find(e => e.displayName == pathes[i - 1]);
                            parentItem.AddChild(existItem);
                        }
                        if (i == pathes.Length - 1)
                        {
                            existItem.editor = editor;
                        }
                    }
                    else
                    {
                        if (i == pathes.Length - 1)
                        {
                            existItem.editor = editor;
                        }
                    }
                    parent = existItem;
                }
            }
            SetupDepthsFromParentsAndChildren(root);
            return(root);
        }
Ejemplo n.º 3
0
        public void RefreshTreeData(SeanLibManager drawer)
        {
            var editorTypes = AssemblyTool.FindTypesInCurrentDomainWhereAttributeIs <CustomSeanLibEditor>();

            editorTypes.RemoveAll(e => ReflecTool.GetAttribute <CustomSeanLibEditor>(e).IsDoc != isdoc);
            editorTypes.Sort((l, r) =>
            {
                return(ReflecTool.GetAttribute <CustomSeanLibEditor>(l).order - ReflecTool.GetAttribute <CustomSeanLibEditor>(r).order);
            });
            editors = new List <SeanLibEditor>(editorTypes.Count);
            foreach (var item in editorTypes)
            {
                SeanLibEditor editor = ReflecTool.Instantiate(item) as SeanLibEditor;
                //editor.OnEnable(drawer);
                editors.Add(editor);
            }
            Reload();
        }