Beispiel #1
0
        private void UpdateLoop()
        {
            projectWindows.ForEach(projectBrowser =>
            {
                if (projectBrowser.showing)
                {
                    if (projectBrowser.window == null)
                    {
                        projectBrowser.showing = false;
                    }
                    else
                    {
                        if (projectBrowser.window.titleContent.text != projectBrowser.name)
                        {
                            projectBrowser.window.Close();
                            projectBrowser.showing = false;
                            return;
                        }
                        // Save position and grid size
                        projectBrowser.position = projectBrowser.window.position;
                        var val = ProjectBrowserUtils.GetListAreaGridSize(projectBrowser.window);

                        ProjectBrowserUtils.HideFolderTree(projectBrowser.window);
                        ProjectBrowserUtils.SetSearchViewState(projectBrowser.window, 3);
                        ProjectBrowserUtils.SetSelectedPathText(projectBrowser.window, "Viewing Browser: " + projectBrowser.path);
                        ProjectBrowserUtils.IgnoreBreadcrumbsPath(projectBrowser.window, Directory.GetParent(projectBrowser.path).ToString());
                        ProjectBrowserUtils.ShowFolderSearchOnly(projectBrowser.window);

                        projectBrowser.window.Repaint();
                    }
                }
            });
        }
Beispiel #2
0
        public void CreateProjectBrowser(string path, string name)
        {
            if (projectWindows.Exists(x => x.name == name) == false)
            {
                ProjectWindowData newDat = new ProjectWindowData();
                newDat.name      = name;
                newDat.path      = path;
                newDat.showing   = false;
                newDat.gridScale = 70;
                newDat.position  = new Rect(UnityEngine.Random.Range(0, Screen.width), UnityEngine.Random.Range(0, Screen.height), 600, 300);
                projectWindows.Add(newDat);
            }
            ProjectWindowData projectBrowser = projectWindows.First(x => x.name == name);
            EditorWindow      windowToClose  = null;

            if (projectBrowser.window != null)
            {
                projectBrowser.showing = false;
                windowToClose          = projectBrowser.window;
                projectBrowser         = null;
            }
            // A new folder needs to be created if none exist
            ProjectBrowserUtils.GetOrCreateAssetFolder(path, true);

            // Set the path to saved
            projectBrowser.path = path;

            projectBrowser.window = ProjectBrowserUtils.CreateProjectWindow(this, name, projectBrowser.gridScale);

            ProjectBrowserUtils.SetTwoColumn(projectBrowser.window);
            ProjectBrowserUtils.SetLocked(projectBrowser.window, true);
            ProjectBrowserUtils.ViewFolder(projectBrowser.window, path);
            ProjectBrowserUtils.ClearFolderViewScrollbars(projectBrowser.window);
            ProjectBrowserUtils.ShowFolderSearchOnly(projectBrowser.window);

            // Move to saved spot
            if (projectBrowser.position == new Rect())
            {
                projectBrowser.position = projectBrowser.window.position;
            }
            projectBrowser.window.position = projectBrowser.position;

            projectBrowser.showing = true;

            if (windowToClose != null)
            {
                windowToClose.Close();
            }
        }