Esempio n. 1
0
        private void DrawToolbar(Rect rect)
        {
            GUILayout.BeginArea(rect);
            {
                GUILayout.BeginHorizontal();
                {
                    if (EGUILayout.ToolbarButton("New"))
                    {
                        var newData = EGUIUtility.CreateAsset <AvatarCreatorData>();
                        if (newData != null)
                        {
                            string assetPath = AssetDatabase.GetAssetPath(newData);
                            dataListView.AddItem(assetPath);

                            dataListView.SetSelection(dataListView.GetCount() - 1);
                        }
                    }
                    if (EGUILayout.ToolbarButton("Delete"))
                    {
                        if (currentCreatorData != null)
                        {
                            string assetPath = AssetDatabase.GetAssetPath(currentCreatorData);
                            dataListView.RemoveItem(assetPath);

                            DeleteCreatorData(currentCreatorData);

                            dataListView.SetSelection(-1);
                        }
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndArea();
        }
Esempio n. 2
0
        protected override TreeViewItem BuildRoot()
        {
            SimpleListTreeViewItem <T> root = SimpleListTreeViewItem <T> .DefaultRoot;

            for (int i = 0; i < listView.GetCount(); ++i)
            {
                SimpleListTreeViewItem <T> item = new SimpleListTreeViewItem <T>(i, listView.GetItem(i));
                root.AddChild(item);
            }

            return(root);
        }