/// <summary>
        /// display inside preferences
        /// </summary>
        /// <param name="serialized"></param>
        private static void PreferenceGUI()
        {
            EditorGUILayout.HelpBox(SHORT_NAME_PREFERENCE + " Preferences", MessageType.Info);

            if (!ExtGUILayout.Section("Scene Workflow options", "SceneAsset Icon", true, "ICI TOOLTIP", 5))
            {
                ManageBool(SHOW_SCENE_BUTTONS, "Show Scenes Buttons", "Show main toolbar menu", DEFAULT_SHOW_SCENE_BUTTON);
                ManageSlider(POSITION_IN_TOOLBAR, "Position in toolbar: ", "Desired Position on unity toolbar", DEFAULT_POSITION_IN_TOOLBAR, 0f, 1f);
                ManageBool(SHOW_INDEX_OF_SCENE, "Show only index of context", "Disable if you want to display the full name instead of index (may be too long for your toolbar)", DEFAULT_SHOW_INDEX_OF_SCENE);
                GUILayout.Space(25);
            }
        }
        /// <summary>
        /// display inside preferences
        /// </summary>
        /// <param name="serialized"></param>
        private static void PreferenceGUI()
        {
            EditorGUILayout.HelpBox(SHORT_NAME_PREFERENCE + " Preferences", MessageType.Info);

            if (!ExtGUILayout.Section("Peek Toolbar", "Slider Icon", true, "Peek toolbar fold options", PADDING_BOTTOM_SECTION))
            {
                ManageBool(SHOW_PEEK_MENU, "Show Peek menu", "Show main toolbar menu", true);
                ManageSlider(POSITION_IN_TOOLBAR, "Position in toolbar: ", "Desired Position on unity toolbar", DEFAULT_TOOLBAR_POSITION, 0f, 1f);
                GUILayout.Space(SPACING_SECTION);
            }

            if (!ExtGUILayout.Section("Shortcuts", "PreTextureAlpha", true, "Shortcut Peek Toolbar fold options", PADDING_BOTTOM_SECTION))
            {
                ExtShortCutEditor.ShortCutOneModifier2Keys("Selection Back & Forward: ",
                                                           "Shortcut to browse through previous selections",
                                                           SHORTCUT_MODIFIER_KEY_FOR_PREVIOUS_NEXT_SELECTION, DEFAULT_MODIFIER_KEY,
                                                           SHORTCUT_KEY_FOR_PREVIOUS_SELECTION, DEFAULT_PREVIOUS_KEY,
                                                           SHORTCUT_KEY_FOR_NEXT_SELECTION, DEFAULT_NEXT_KEY);

                GUILayout.Space(SPACING_SECTION);
            }

            if (!ExtGUILayout.Section("Peek Window", "winbtn_win_rest_h", true, "Peek window fold options", PADDING_BOTTOM_SECTION))
            {
                EditorGUI.BeginChangeCheck();
                {
                    ManagePositiveInt(MAX_SELECTED_OBJECT_STORED, "Max global storage", "max previous selection saved", 1000);
                    ManagePositiveInt(MAX_SELECTED_OBJECT_SHOWN, "Max previously selected shown", "max item shown inside the previously selected section", 100);
                    ManagePositiveInt(MAX_PINNED_OBJECT, "Max bookmark", "Max Bookmarked objects", 20);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    if (PeekSerializeObject.ShrunkListIfNeeded())
                    {
                        PeekSerializeObject.Save();
                    }
                }
                ManageBool(SHOW_GAMEOBJECTS_FROM_OTHER_SCENE, "Show GameOjbects from other scene", "the reference may be recover if user change scene, or Undo deletion", true);
                EditorGUI.BeginChangeCheck();
                {
                    ManageSliderInt(FONT_SIZE_PEEK_WINDOW, "Font of gameObject's name: ", "Font of the text inside each items", DEFAULT_FONT_PEEK_WINDOW_ITEMS, 6, 20);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    ExtGUIStyles.MicroButtonLeftCenter.fontSize = EditorPrefs.GetInt(FONT_SIZE_PEEK_WINDOW, 14);
                }
                DisplayClearListButton();
                GUILayout.Space(SPACING_SECTION);
            }
        }
Esempio n. 3
0
        public void Display()
        {
            float widthEditorWindow = _peekWindow.position.width;
            //float widthWithoutScrollBar = widthEditorWindow - SIZE_SCROLL_BAR;
            float widthScope = widthEditorWindow - SIZE_SCROLL_BAR * 2;

            if (ExtGUILayout.Section(_listDescription, _iconList, true, _foldStateKey, 0))
            {
                return;
            }
            _dragSettings.SaveFirstItemPosition(_heightLine, _margin);

            Color oldColor = GUI.color;

            _dragSettings.CalculateEmptyCellIndexBasedOnPosition(_heightLine, _margin);


            if (_dragSettings.IsDragging && _dragSettings.CurrentIndexShouldPointEmptyCell == ListToDisplay.arraySize)
            {
                DisplayEmptyCellItem(widthScope);
                _dragSettings.RealDropIndex = ListToDisplay.arraySize - 1;
                GUI.color = oldColor;
            }

            for (int i = ListToDisplay.arraySize - 1; i >= 0; i--)
            {
                if (_dragSettings.IsDragging && i == _dragSettings.CurrentIndexSelected)
                {
                    if (i == _dragSettings.CurrentIndexShouldPointEmptyCell)
                    {
                        DisplayEmptyCellItem(widthScope);
                        _dragSettings.RealDropIndex = i;
                    }
                    continue;
                }
                string nameToShow = ListToDisplayPath?.GetArrayElementAtIndex(i).stringValue;
                if (SceneLinkedPath != null && SceneLinkedPath.GetArrayElementAtIndex(i).GetCustomObject() != null)
                {
                    nameToShow = SceneLinkedPath.GetArrayElementAtIndex(i).GetCustomObject().name + "/" + nameToShow;
                }
                DisplayOneItem(ListToDisplay.GetArrayElementAtIndex(i).GetCustomObject(), nameToShow, i, widthScope, false);
                if (_dragSettings.IsDragging && i == _dragSettings.CurrentIndexShouldPointEmptyCell)
                {
                    DisplayEmptyCellItem(widthScope);
                    _dragSettings.RealDropIndex = i - (_dragSettings.CurrentIndexSelected < i ? 1 : 0);
                }

                GUI.color = oldColor;
            }

            _dragSettings.SaveLastItemPosition();
            _dragSettings.SetHowManyCellAreDisplayed(ListToDisplay.arraySize);

            ClearList(widthScope, OnClear);



            if (_dragSettings.CanReorder && _dragSettings.IsDragging)
            {
                IsDraggingItem(ListToDisplay.GetArrayElementAtIndex(_dragSettings.CurrentIndexSelected).GetCustomObject(), ListToDisplayPath?.GetArrayElementAtIndex(_dragSettings.CurrentIndexSelected).stringValue, _dragSettings.CurrentIndexSelected);
                GUI.color = oldColor;
            }
        }