private void SelectionChanged(int[] selectedIDs)
        {
            this.m_Selection = new List <PackageImportTreeViewItem>();
            foreach (TreeViewItem item in this.m_TreeView.data.GetRows())
            {
                if (selectedIDs.Contains <int>(item.id))
                {
                    PackageImportTreeViewItem item2 = item as PackageImportTreeViewItem;
                    if (item2 != null)
                    {
                        this.m_Selection.Add(item2);
                    }
                }
            }
            ImportPackageItem item3 = this.m_Selection[0].item;

            if (((this.m_Selection.Count == 1) && (item3 != null)) && !string.IsNullOrEmpty(item3.previewPath))
            {
                PackageImportTreeViewGUI gui = this.m_TreeView.gui as PackageImportTreeViewGUI;
                gui.showPreviewForID = this.m_Selection[0].id;
            }
            else
            {
                PopupWindowWithoutFocus.Hide();
            }
        }
Ejemplo n.º 2
0
        public PackageImportTreeView(AssetsItem[] items, List <string> enabledFolders, TreeViewState treeViewState, EditorWindow editorWindow, Rect startRect)
        {
            this.m_TreeView = new TreeView(editorWindow, treeViewState);
            PackageImportTreeViewDataSource data = new PackageImportTreeViewDataSource(this.m_TreeView, items, enabledFolders);
            PackageImportTreeViewGUI        gui  = new PackageImportTreeViewGUI(this.m_TreeView);

            this.m_TreeView.Init(startRect, data, gui, null);
            this.m_TreeView.ReloadData();
            this.m_TreeView.selectionChangedCallback = (Action <int[]>)Delegate.Combine(this.m_TreeView.selectionChangedCallback, new Action <int[]>(this.SelectionChanged));
            gui.itemWasToggled = (Action <PackageImportTreeViewItem>)Delegate.Combine(gui.itemWasToggled, new Action <PackageImportTreeViewItem>(this.ItemWasToggled));
            this.ComputeEnabledStateForFolders();
        }
        public PackageImportTreeView(PackageImport packageImport, TreeViewState treeViewState, Rect startRect)
        {
            this.m_PackageImport = packageImport;
            this.m_TreeView      = new TreeView(this.m_PackageImport, treeViewState);
            PackageImportTreeViewDataSource data = new PackageImportTreeViewDataSource(this.m_TreeView, this);
            PackageImportTreeViewGUI        gui  = new PackageImportTreeViewGUI(this.m_TreeView, this);

            this.m_TreeView.Init(startRect, data, gui, null);
            this.m_TreeView.ReloadData();
            this.m_TreeView.selectionChangedCallback = (Action <int[]>)Delegate.Combine(this.m_TreeView.selectionChangedCallback, new Action <int[]>(this.SelectionChanged));
            gui.itemWasToggled = (Action <PackageImportTreeViewItem>)Delegate.Combine(gui.itemWasToggled, new Action <PackageImportTreeViewItem>(this.ItemWasToggled));
            this.ComputeEnabledStateForFolders();
        }
        public PackageImportTreeView(PackageImport packageImport, TreeViewState treeViewState, Rect startRect)
        {
            m_PackageImport = packageImport;

            m_TreeView = new TreeViewController(m_PackageImport, treeViewState);
            var dataSource = new PackageImportTreeViewDataSource(m_TreeView, this);
            var gui        = new PackageImportTreeViewGUI(m_TreeView, this);

            m_TreeView.Init(startRect, dataSource, gui, null);
            m_TreeView.ReloadData();
            m_TreeView.selectionChangedCallback += SelectionChanged;
            gui.itemWasToggled += ItemWasToggled;

            ComputeEnabledStateForFolders();
        }