示例#1
0
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGScenesWindow.TitleColor);

            Metrics.UseTool(10);             // NGScenes

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            if (NGScenesWindow.allScenes == null)
            {
                string[] allScenes = AssetDatabase.GetAllAssetPaths();

                list.Clear();
                for (int i = 0; i < allScenes.Length; i++)
                {
                    if (allScenes[i].EndsWith(".unity", StringComparison.OrdinalIgnoreCase) == true)
                    {
                        list.Add(new Scene(allScenes[i]));
                    }
                }

                list.Sort((a, b) => a.name.CompareTo(b.name));
                NGScenesWindow.allScenes = list.ToArray();
            }

            this.allListDrawer            = new GUIListDrawer <Scene>();
            this.allListDrawer.array      = NGScenesWindow.allScenes;
            this.allListDrawer.ElementGUI = this.DrawSceneRow;

            this.recentListDrawer            = new GUIListDrawer <Scene>();
            this.recentListDrawer.ElementGUI = this.DrawSceneRow;

            this.UpdateRecentScenes();

            this.buildListDrawer = new GUIListDrawer <EditorBuildSettingsScene>();
            this.buildListDrawer.drawBackgroundColor = true;
            this.buildListDrawer.handleSelection     = true;
            this.buildListDrawer.handleDrag          = true;
            this.buildListDrawer.ElementGUI          = this.DrawBuildSceneRow;
            this.buildListDrawer.PostGUI             = this.DropScene;
            this.buildListDrawer.DeleteSelection     = this.DeleteBuildScenes;
            this.buildListDrawer.ArrayReordered      = (l) => EditorBuildSettings.scenes = l.array;

            NGEditorApplication.ChangeScene += this.UpdateRecentScenes;

            this.wantsMouseMove = true;
        }
示例#2
0
        private void    DropScene(GUIListDrawer <EditorBuildSettingsScene> list)
        {
            if (Event.current.type == EventType.DragUpdated)
            {
                bool one = false;

                for (int i = 0; i < DragAndDrop.paths.Length; i++)
                {
                    if (DragAndDrop.paths[i].EndsWith(".unity", StringComparison.OrdinalIgnoreCase) == true)
                    {
                        one = true;
                        break;
                    }
                }

                if (one == true)
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Move;
                }
                else
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;
                }

                Event.current.Use();
            }
            else if (Event.current.type == EventType.DragPerform)
            {
                DragAndDrop.AcceptDrag();

                List <EditorBuildSettingsScene> scenes = new List <EditorBuildSettingsScene>(EditorBuildSettings.scenes);

                for (int i = 0; i < DragAndDrop.paths.Length; i++)
                {
                    if (DragAndDrop.paths[i].EndsWith(".unity", StringComparison.OrdinalIgnoreCase) == true)
                    {
                        scenes.Add(new EditorBuildSettingsScene(DragAndDrop.paths[i], true));
                    }
                }

                EditorBuildSettings.scenes = scenes.ToArray();

                Event.current.Use();
            }
        }
示例#3
0
        protected virtual void  OnEnable()
        {
            Utility.RegisterWindow(this);
            Utility.RestoreIcon(this, NGNavSelectionWindow.TitleColor);

            Metrics.UseTool(9);             // NGNavSelection

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            this.minSize = new Vector2(140F, Constants.SingleLineHeight);

            this.listDrawer             = new GUIListDrawer <AssetsSelection>();
            this.listDrawer.list        = NGNavSelectionWindow.historic;
            this.listDrawer.ElementGUI  = this.DrawSelection;
            this.listDrawer.reverseList = true;

            HQ.SettingsChanged += this.Repaint;
            NGNavSelectionWindow.SelectionChanged += this.Repaint;
        }
示例#4
0
        private void    DeleteBuildScenes(GUIListDrawer <EditorBuildSettingsScene> list)
        {
            List <EditorBuildSettingsScene> scenes = new List <EditorBuildSettingsScene>(EditorBuildSettings.scenes);

            for (int i = 0; i < list.selection.Count; i++)
            {
                scenes[list.selection[i]] = null;
            }

            for (int i = 0; i < scenes.Count; i++)
            {
                if (scenes[i] == null)
                {
                    scenes.RemoveAt(i);
                    --i;
                }
            }

            EditorBuildSettings.scenes = scenes.ToArray();
        }