Пример #1
0
        /////////////////////////////////////////
        void DrawLeftPane()
        {
            HGUIToolbar.Begin();
            if (HGUIToolbar.Button(EditorIcon.toolbar_plus))
            {
                _add();
            }
            if (HGUIToolbar.Button(EditorIcon.toolbar_minus))
            {
                _minus();
            }
            GUILayout.FlexibleSpace();
            HGUIToolbar.End();

            m_treeView.DrawLayoutGUI();

            void _add()
            {
                PB.i.profileList.Add(new PB.Profile($"BuildScene ({PB.i.profileList.Count})"));
                PB.Save();
                m_treeView.RegisterFiles();
            }

            void _minus()
            {
                PB.i.profileList.Remove(m_treeView.currentItem.profile);
                PB.Save();

                m_treeView.RegisterFiles();
            }
        }
Пример #2
0
        /////////////////////////////////////////
        void OnRowGUISceneSet(RowGUIArgs args, Item item)
        {
            if (item.title)
            {
                if (item.id == 1)
                {
                    s_buildNo = 0;
                }
                if (!args.selected)
                {
                    HEditorStyles.sceneTopBarBg.Draw(args.rowRect);
                }
                DefaultRowGUI(args);
                return;
            }

            //DefaultRowGUI( args );
            var rect = args.rowRect;

            rect.x += 4;

            if (HEditorGUI.IconButton(rect.W(16), EditorIcon.minus))
            {
                EditorHelper.RemoveSceneToBuildSetting(item.path);
                m_registerItems.Remove(item);
                ReloadAndSorting();
                //EditorApplication.delayCall += () => RegisterFiles( m_profile );
            }

            rect.x += 16;
            if (HEditorGUI.IconButton(rect.W(16), EditorIcon.sceneasset))
            {
                EditorHelper.PingObject(item.path);
            }

            rect.x += 16;
            ScopeChange.Begin();
            item.toggle = EditorGUI.Toggle(rect.W(16), item.toggle);
            if (ScopeChange.End())
            {
                m_profile.Toggle(item.toggle, item.path);
                PB.Save();
            }

            rect.x += 20;

            Label(args, rect, item.displayName);

            if (item.toggle)
            {
                var ss = $"{s_buildNo}";
                var sz = ss.CalcSize(HEditorStyles.treeViewLine);
                rect    = args.rowRect.AlignR(sz.x);
                rect.x -= 4;
                Label(args, rect, ss);
                s_buildNo++;
            }
        }
Пример #3
0
        public static void DrawGUI()
        {
            P.Load();
            PB.Load();
            Styles.Init();

            DrawContentConfig();

            if (s_changed)
            {
                P.Save();
                PB.Save();
                BuildAssistWindow.Repaint();
            }
        }
Пример #4
0
        /////////////////////////////////////////
        protected override void RenameEnded(RenameEndedArgs args)
        {
            base.RenameEnded(args);

            if (args.newName.Length <= 0)
            {
                goto failed;
            }
            if (args.newName == args.originalName)
            {
                goto failed;
            }
            args.acceptedRename = true;

            var item = ToItem(args.itemID);

            item.displayName         = args.newName;
            item.profile.profileName = args.newName;
            PB.Save();
            return;

failed:
            args.acceptedRename = false;
        }
Пример #5
0
        static void DrawContentConfig()
        {
            ScopeChange.Begin();

            //PB.i.enableAssetBundleBuild = HEditorGUILayout.ToggleLeft( S._EnableAssetBundleBuild, PB.i.enableAssetBundleBuild );
            //HEditorGUI.DrawDebugRectAtLastRect();
            PB.i.enableOldStyleProjectSettings = HEditorGUILayout.ToggleLeft(S._Usingtheold_styleProjectSettings, PB.i.enableOldStyleProjectSettings);
            GUILayout.Space(8);
            PB.i.enableExlusionAssets = HEditorGUILayout.ToggleLeft(S._Enablingassetexclusionatbuildtime, PB.i.enableExlusionAssets);

            GUILayout.Label(S._ExclusionAssetsList, EditorStyles.boldLabel);

            if (s_exclusionContents == null)
            {
                if (PB.i.exclusionAssets == null)
                {
                    PB.i.exclusionAssets = new List <PB.ExclusionSets>();
                }

                //foreach(var p in PB.i.exclusionAssets ) {
                //	Debug.Log( GUIDUtils.GetAssetPath( p.GUID ) );
                //}
                s_exclusionContents = PB.i.exclusionAssets.Select(x => x.GUID.ToAssetPath()).OrderBy(value => value).Select(x => new GUIContent(x, AssetDatabase.GetCachedIcon(x))).ToArray();
            }

            int removeIndex = -1;

            ScopeVertical.Begin(EditorStyles.helpBox);
            for (int i = 0; i < s_exclusionContents.Length; i++)
            {
                var s = s_exclusionContents[i];
                ScopeHorizontal.Begin();
                GUILayout.Label(EditorHelper.TempContent(""), GUILayout.ExpandWidth(true), GUILayout.Height(18));
                ScopeHorizontal.End();

                var rc = GUILayoutUtility.GetLastRect();
                GUI.Box(rc, "", Styles.projectBrowserHeaderBgMiddle);
                GUI.Label(rc, s, Styles.labelAndIcon);
                rc.x     = rc.xMax - 16;
                rc.width = 16;
                if (HEditorGUI.IconButton(rc, EditorIcon.minus))
                {
                    removeIndex = i;
                }
            }
            GUILayout.FlexibleSpace();
            if (0 <= removeIndex)
            {
                var findGUID = s_exclusionContents[removeIndex].text.ToGUID();
                var rIndex   = PB.i.exclusionAssets.FindIndex(x => x.GUID == findGUID);
                PB.i.exclusionAssets.RemoveAt(rIndex);
                s_exclusionContents = null;
                s_changed           = true;
            }
            ScopeVertical.End();

            var dropRc = GUILayoutUtility.GetLastRect();
            var evt    = Event.current;

            switch (evt.type)
            {
            case EventType.DragUpdated:
            case EventType.DragPerform:
                if (!dropRc.Contains(evt.mousePosition))
                {
                    break;
                }

                DragAndDrop.visualMode = DragAndDropVisualMode.Copy;

                void AddFiles(params string[] paths)
                {
                    PB.i.exclusionAssets.AddRange(paths.Select(x => new PB.ExclusionSets(x.ToGUID(), x)).ToArray());
                    PB.i.exclusionAssets = PB.i.exclusionAssets.Distinct(x => x.GUID).ToList();
                    PB.Save();
                }

                string[] DirFiles(string path)
                {
                    return(DirectoryUtils.GetFiles(path, "*", SearchOption.AllDirectories).Where(x => x.Extension() != ".meta").ToArray());
                }

                if (evt.type == EventType.DragPerform)
                {
                    DragAndDrop.AcceptDrag();
                    if (DragAndDrop.paths.Length == 1)
                    {
                        if (Directory.Exists(DragAndDrop.paths[0]))
                        {
                            var m = new GenericMenu();
                            m.AddItem(S._Registerasafolder, false, (context) => {
                                AddFiles((string)context);
                            }, DragAndDrop.paths[0]);
                            m.AddItem(S._Registeringfilescontainedinafolder, false, (context) => {
                                AddFiles(DirFiles((string)context));
                                ;
                            }, DragAndDrop.paths[0]);
                            m.DropDownAtMousePosition();
                        }
                        else
                        {
                            AddFiles(DragAndDrop.paths);
                        }
                    }
                    else
                    {
                        bool dirChekc = false;
                        foreach (var s in DragAndDrop.paths)
                        {
                            if (Directory.Exists(s))
                            {
                                dirChekc = true;
                                break;
                            }
                        }
                        if (dirChekc)
                        {
                            var m = new GenericMenu();
                            m.AddItem(S._Registerasafolder, false, (context) => {
                                AddFiles((string[])context);
                            }, DragAndDrop.paths);
                            m.AddItem(S._Registeringfilescontainedinafolder, false, (context) => {
                                foreach (var s in ((string[])context))
                                {
                                    if (Directory.Exists(s))
                                    {
                                        AddFiles(DirFiles(s));
                                    }
                                    else
                                    {
                                        AddFiles(s);
                                    }
                                }
                            }, DragAndDrop.paths);
                            m.DropDownAtMousePosition();
                        }
                        else
                        {
                            AddFiles(DragAndDrop.paths);
                        }
                    }

                    DragAndDrop.activeControlID = 0;

                    s_exclusionContents = null;
                }
                s_changed = true;
                Event.current.Use();
                break;
            }

            if (ScopeChange.End())
            {
                s_changed = true;
            }
        }