static DUIHierarchyManager()
        {
            if (DUI.DUISettings == null)
            {
                DUI.CreateDUISettings(); if (DUI.DUISettings == null)
                {
                    return;
                }
            }

            uiButtonIDs       = new Dictionary <int, UIButton>();
            uiCanvasIDs       = new Dictionary <int, UICanvas>();
            uiEffectIDs       = new Dictionary <int, UIEffect>();
            uiElementIDs      = new Dictionary <int, UIElement>();
            uiTriggerIDs      = new Dictionary <int, UITrigger>();
            uiNotificationIDs = new Dictionary <int, UINotification>();

#if dUI_PlayMaker
            playmakerEventDispatcherIDs = new Dictionary <int, PlaymakerEventDispatcher>();
#endif

            UpdateReferences();

            startTime = EditorApplication.timeSinceStartup;
            EditorApplication.update += EditorUpdate;

            EditorApplication.hierarchyWindowChanged   += UpdateReferences;
            EditorApplication.hierarchyWindowItemOnGUI += HierarchyCustomizer;
        }
        void DrawUICanvases()
        {
            QUI.DrawTexture(DUIResources.headerUICanvasesDatabase.texture, 552, 64);
            float sectionWidth = PAGE_WIDTH - SIDE_BAR_SHADOW_WIDTH * 2;

            QUI.BeginHorizontal(sectionWidth);
            {
                QUI.Space(-22);
                QUI.BeginChangeCheck();
                {
                    DrawNamesList(DUI.CanvasNamesDatabase.data, sectionWidth + 22 + 12 - 100, "Add a new canvas name to get started...");
                }
                if (QUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(DUI.CanvasNamesDatabase);
                }
                QUI.Space(-12);
                if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSortAtoZ), 100, 20))
                {
                    DUI.RefreshCanvasNamesDatabase();
                }
            }
            QUI.EndHorizontal();
            QUI.Space(16);
            if (DUI.CanvasNamesDatabase.Count == 0)
            {
                QUI.DrawTexture(DUIResources.pageImageEmptyDatabase.texture, 552, 256);
                return;
            }
        }
Ejemplo n.º 3
0
 void RefreshCanvasNamesDatabase(bool forcedRefresh)
 {
     if (DUI.CanvasNamesDatabase == null || forcedRefresh)
     {
         DUI.RefreshCanvasNamesDatabase();
     }
 }
 void RefreshUIButtonsDatabase(bool forcedRefresh = false)
 {
     if (DUI.UIButtonsDatabase == null || forcedRefresh)
     {
         DUI.RefreshUIButtonsDatabase();
     }
 }
Ejemplo n.º 5
0
 void ValidateUICanvasCanvasName()
 {
     if (canvasName.stringValue.Equals(UICanvas.DEFAULT_CANVAS_NAME))
     {
         customCanvasName.boolValue = false;
     }
     if (customCanvasName.boolValue)
     {
         return;
     }
     if (!DUI.CanvasNamesDatabase.Contains(canvasName.stringValue)) //canvas name does not exist in canvas datatabase -> ask it it should be added
     {
         if (!string.IsNullOrEmpty(canvasName.stringValue.Trim()) && EditorUtility.DisplayDialog("Action Required", "The '" + canvasName.stringValue + "' canvas name does not exist in the canvas names database.\nDo you want to add it now?", "Yes", "No"))
         {
             DUI.AddCanvasName(canvasName.stringValue);
             customCanvasName.boolValue = false;
         }
         else
         {
             EditorUtility.DisplayDialog("Information", "The canvas name was left unchanged and this UICanvas was set to use a custom canvas name." +
                                         "\n\n" +
                                         "Having a custom canvas name means that the name is not in the Canvas Database.", "Ok");
             customCanvasName.boolValue = true;
             return;
         }
     }
     canvasNameIndex = DUI.CanvasNamesDatabase.IndexOf(canvasName.stringValue);
 }
Ejemplo n.º 6
0
 private void RefreshCanvasNamesDatabase(bool forcedRefresh = false)
 {
     if (DUI.CanvasNamesDatabase == null || forcedRefresh)
     {
         EditorUtility.DisplayProgressBar("Reloading Data", "Refreshing the UICanvases Database...", 0.5f);
         DUI.RefreshCanvasNamesDatabase();
     }
     EditorUtility.ClearProgressBar();
 }
 void ValiateUIButtonNameAndCategory()
 {
     if (string.IsNullOrEmpty(buttonName.stringValue)) //buttonName is empty? -> reset button name to default
     {
         buttonName.stringValue = DUI.DEFAULT_BUTTON_NAME;
     }
     if (buttonCategory.stringValue != DUI.CUSTOM_NAME)
     {
         if (!DUI.UIButtonCategoryExists(buttonCategory.stringValue)) //category does not exist -> reset button category to default
         {
             EditorUtility.DisplayDialog("Information", "This button's category is set to '" + buttonCategory.stringValue + "', but this category was not found in the UIButtons Database.\nResetting this button's category to the default value (" + DUI.DEFAULT_CATEGORY_NAME + ").", "Ok");
             buttonCategory.stringValue = DUI.DEFAULT_CATEGORY_NAME;
         }
         if (!DUI.UIButtonNameExists(buttonCategory.stringValue, buttonName.stringValue)) //button name does not exist in the set category -> change category to default & add the button name to the database
         {
             if (EditorUtility.DisplayDialog("Action Required", "This button's name is set to '" + buttonName.stringValue + "', but it was not found in the '" + buttonCategory.stringValue + "' category.\nDo you want to add the name to the set category?", "Yes", "No"))
             {
                 DUI.AddUIButtonName(buttonCategory.stringValue, buttonName.stringValue);
                 buttonNameIndex = DUI.GetUIButtonNames(buttonCategory.stringValue).IndexOf(buttonName.stringValue);
             }
             else
             {
                 EditorUtility.DisplayDialog("Information", "This button's category was reset to the default value (" + DUI.DEFAULT_CATEGORY_NAME + ").", "Ok");
                 buttonCategory.stringValue = DUI.DEFAULT_CATEGORY_NAME;
                 if (!DUI.UIButtonNameExists(buttonCategory.stringValue, buttonName.stringValue))
                 {
                     if (EditorUtility.DisplayDialog("Action Required", "This button's name is set to '" + buttonName.stringValue + "', but it was not found in the '" + buttonCategory.stringValue + "' category.\nDo you want to add the name to the set category?", "Yes", "No"))
                     {
                         DUI.AddUIButtonName(buttonCategory.stringValue, buttonName.stringValue);
                         buttonNameIndex = DUI.GetUIButtonNames(buttonCategory.stringValue).IndexOf(buttonName.stringValue);
                     }
                     else
                     {
                         EditorUtility.DisplayDialog("Information", "This button's name was reset to the default value (" + DUI.DEFAULT_BUTTON_NAME + ").", "Ok");
                         buttonName.stringValue = DUI.DEFAULT_BUTTON_NAME;
                         buttonNameIndex        = DUI.GetUIButtonNames(buttonCategory.stringValue).IndexOf(buttonName.stringValue);
                     }
                 }
                 else
                 {
                     buttonNameIndex = DUI.GetUIButtonNames(buttonCategory.stringValue).IndexOf(buttonName.stringValue);
                 }
             }
         }
         else
         {
             buttonNameIndex = DUI.GetUIButtonNames(buttonCategory.stringValue).IndexOf(buttonName.stringValue);
         }
     }
     else
     {
         buttonNameIndex = DUI.GetUIButtonNames(DUI.DEFAULT_CATEGORY_NAME).IndexOf(DUI.DEFAULT_BUTTON_NAME);
     }
     buttonCategoryIndex = DUI.UIButtonCategories.IndexOf(buttonCategory.stringValue);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Retrurns true if the soundName was found or was added to the database
        /// </summary>
        /// <param name="soundName"></param>
        /// <returns></returns>
        private bool AddSoundToDatabase(string soundName)
        {
            InitSoundsDatabase();
            if (soundsDatabase.ContainsKey(soundName))
            {
                return(true);
            }
            UISound soundItem = DUI.GetUISound(soundName);

            if (soundItem == null)
            {
                Debug.Log("NULL UISound"); return(false);
            }                                                                   //the UISound was not found in the Resources folder -> thus it could not be added
            soundsDatabase.Add(soundName, soundItem);
            return(true);
        }
 private void RefreshUIButtonsDatabase(bool forcedRefresh = false)
 {
     if (DUI.UIButtonsDatabase == null || forcedRefresh)
     {
         EditorUtility.DisplayProgressBar("Reloading Data", "Refreshing the UIButtons Database...", 0.5f);
         DUI.RefreshUIButtonsDatabase();
     }
     EditorUtility.DisplayProgressBar("Reloading Data", "Quick cleanup...", 0.75f);
     UIButtonsDatabaseAnimBool = new Dictionary <string, AnimBool>();
     foreach (string category in DUI.UIButtonsDatabase.Keys)
     {
         DUI.UIButtonsDatabase[category].RemoveEmpty();
         DUI.UIButtonsDatabase[category].Sort();
         UIButtonsDatabaseAnimBool.Add(category, new AnimBool(false));
     }
     EditorUtility.ClearProgressBar();
 }
 void DrawButtonName()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Button Name", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_105);
         if (EditorApplication.isPlayingOrWillChangePlaymode)
         {
             QUI.Label(buttonName.stringValue, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormalItalic));
         }
         else
         {
             if (buttonCategory.stringValue.Equals(DUI.CUSTOM_NAME))
             {
                 EditorGUILayout.DelayedTextField(buttonName, GUIContent.none);
             }
             else
             {
                 if (DUI.GetUIButtonNames(DUI.UIButtonCategories[buttonCategoryIndex]).Count == 0)
                 {
                     QUI.Label(buttonName.stringValue, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormalItalic), 90);
                     QUI.FlexibleSpace();
                     QUI.Label("(Empty Category)", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmallItalic), 86);
                 }
                 else
                 {
                     QUI.BeginChangeCheck();
                     {
                         if (!DUI.UIButtonCategoryExists(buttonCategory.stringValue))
                         {
                             RefreshButtonNameAndCategory(true);
                         }
                         buttonNameIndex = EditorGUILayout.Popup(buttonNameIndex, DUI.GetUIButtonNames(buttonCategory.stringValue).ToArray());
                     }
                     if (QUI.EndChangeCheck())
                     {
                         buttonName.stringValue = DUI.GetUIButtonNames(buttonCategory.stringValue)[buttonNameIndex];
                     }
                 }
             }
         }
     }
     QUI.EndHorizontal();
     QUI.Space(SPACE_4);
 }
Ejemplo n.º 11
0
 void ValidateUICanvasCanvasName()
 {
     if (!DUI.CanvasNamesDatabase.Contains(targetCanvasName.stringValue)) //canvas name does not exist in canvas datatabase -> ask it it should be added
     {
         if (!string.IsNullOrEmpty(targetCanvasName.stringValue.Trim()) && EditorUtility.DisplayDialog("Action Required", "The '" + targetCanvasName.stringValue + "' target canvas name does not exist in the canvas names database.\nDo you want to add it now?", "Yes", "No"))
         {
             DUI.AddCanvasName(targetCanvasName.stringValue);
         }
         else
         {
             EditorUtility.DisplayDialog("Information", "The canvas name was reset to the default value. (" + UICanvas.DEFAULT_CANVAS_NAME + ")", "Ok");
             targetCanvasName.stringValue = UICanvas.DEFAULT_CANVAS_NAME;
             if (!DUI.CanvasNamesDatabase.Contains(targetCanvasName.stringValue))
             {
                 DUI.AddCanvasName(targetCanvasName.stringValue);
             }
         }
     }
     canvasNameIndex = DUI.CanvasNamesDatabase.IndexOf(targetCanvasName.stringValue);
 }
Ejemplo n.º 12
0
        public static bool PreviewSound(string soundName)
        {
            if (string.IsNullOrEmpty(soundName.Trim()) || soundName.Equals(DUI.DEFAULT_SOUND_NAME))
            {
                return(false);
            }
#if dUI_MasterAudio
            DTGUIHelper.PreviewSoundGroup(soundName);
            return(true);
#else
            if (DUI.UISoundsDatabase == null)
            {
                DUI.RefreshUISoundsDatabase();
            }
            if (!DUI.UISoundNameExists(soundName))
            {
                return(false);
            }

            AudioClip audioClip = DUI.GetUISound(soundName).audioClip;
            if (audioClip != null) //there is an AudioClip reference -> play it
            {
                QUtils.PlayAudioClip(audioClip);
                return(true);
            }


            audioClip = Resources.Load(DUI.GetUISound(soundName).soundName) as AudioClip;
            if (audioClip != null) //a sound file with the soundName was found in Resources -> play it
            {
                QUtils.PlayAudioClip(audioClip);
                return(true);
            }

            return(false);
#endif
        }
 void DrawButtonCategory()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Button Category", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_105);
         if (EditorApplication.isPlayingOrWillChangePlaymode)
         {
             QUI.Label(buttonCategory.stringValue, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormalItalic));
         }
         else
         {
             QUI.BeginChangeCheck();
             {
                 buttonCategoryIndex = EditorGUILayout.Popup(buttonCategoryIndex, DUI.UIButtonCategories.ToArray());
             }
             if (QUI.EndChangeCheck())
             {
                 if (!DUI.UIButtonCategories[buttonCategoryIndex].Equals(DUI.CUSTOM_NAME))                            //not custom name category?
                 {
                     if (DUI.UIButtonNameExists(DUI.UIButtonCategories[buttonCategoryIndex], buttonName.stringValue)) //does the new category have the button name?
                     {
                         buttonCategory.stringValue = DUI.UIButtonCategories[buttonCategoryIndex];
                         buttonNameIndex            = DUI.GetUIButtonNames(buttonCategory.stringValue).IndexOf(buttonName.stringValue);
                     }
                     else if (buttonName.stringValue.Equals(DUI.DEFAULT_BUTTON_NAME) && DUI.GetUIButtonNames(DUI.UIButtonCategories[buttonCategoryIndex]).Count > 0) //is the button name the default value? && is the new category not empty? -> set button name as the first value
                     {
                         buttonCategory.stringValue = DUI.UIButtonCategories[buttonCategoryIndex];
                         buttonName.stringValue     = DUI.GetUIButtonNames(buttonCategory.stringValue)[0];
                     }
                     else if (!buttonName.stringValue.Equals(DUI.DEFAULT_BUTTON_NAME) && !string.IsNullOrEmpty(buttonName.stringValue.Trim()) && EditorUtility.DisplayDialog("Action Required", "The '" + buttonName.stringValue + "' button name does not exist in the '" + DUI.UIButtonCategories[buttonCategoryIndex] + "' category database.\nDo you want to add it now?", "Yes", "No"))
                     {
                         DUI.AddUIButtonName(DUI.UIButtonCategories[buttonCategoryIndex], buttonName.stringValue);
                         buttonCategory.stringValue = DUI.UIButtonCategories[buttonCategoryIndex];
                         buttonNameIndex            = DUI.GetUIButtonNames(buttonCategory.stringValue).IndexOf(buttonName.stringValue);
                     }
                     else if (DUI.GetUIButtonNames(DUI.UIButtonCategories[buttonCategoryIndex]).Count == 0)
                     {
                         if (EditorUtility.DisplayDialog("Information", "The '" + DUI.UIButtonCategories[buttonCategoryIndex] + "' category is empty.\n\nOpen the UIButtons Database and add some button names to it or delete it.\n\nThe button name and category will now be reset to the default values.", "Ok"))
                         {
                             buttonCategory.stringValue = DUI.DEFAULT_CATEGORY_NAME;
                             buttonCategoryIndex        = DUI.UIButtonCategories.IndexOf(buttonCategory.stringValue);
                             buttonName.stringValue     = DUI.DEFAULT_BUTTON_NAME;
                             buttonNameIndex            = DUI.GetUIButtonNames(buttonCategory.stringValue).IndexOf(buttonName.stringValue);
                         }
                     }
                     else
                     {
                         buttonCategory.stringValue = DUI.UIButtonCategories[buttonCategoryIndex];
                         buttonName.stringValue     = DUI.GetUIButtonNames(buttonCategory.stringValue)[0];
                         buttonNameIndex            = DUI.GetUIButtonNames(buttonCategory.stringValue).IndexOf(buttonName.stringValue);
                     }
                 }
                 else
                 {
                     buttonCategory.stringValue = DUI.UIButtonCategories[buttonCategoryIndex];
                 }
             }
         }
     }
     QUI.EndHorizontal();
 }
        void DrawUIElementsDatabase()
        {
            QUI.DrawTexture(DUIResources.headerUIElementsDatabase.texture, 552, 64);
            float sectionWidth = PAGE_WIDTH - SIDE_BAR_SHADOW_WIDTH * 2;

            QUI.BeginHorizontal(sectionWidth);
            {
                #region New Category
                if (!NewCategoryAnimBool.value)
                {
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonNewCategory), 100 * (1 - SearchPatternAnimBool.faded), 20))
                    {
                        NewCategoryName              = "";
                        NewCategoryAnimBool.target   = true;
                        SearchPatternAnimBool.target = false;
                        foreach (string category in UIElementsDatabaseAnimBool.Keys)
                        {
                            UIElementsDatabaseAnimBool[category].target = false;
                        }
                    }
                }
                else
                {
                    SearchPatternAnimBool.target = false;
                    QUI.DrawTexture(DUIResources.pageButtonNewCategory.active, 100, 20);
                    QUI.Space(80);
                    SaveColors();
                    QUI.SetGUIBackgroundColor(DUIColors.GreenLight.Color);
                    NewCategoryName = EditorGUILayout.TextField(NewCategoryName, GUILayout.Width((sectionWidth - 149) * NewCategoryAnimBool.faded));
                    RestoreColors();
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonOk), 20, 20))
                    {
                        if (string.IsNullOrEmpty(NewCategoryName))
                        {
                            EditorUtility.DisplayDialog("Info", "Cannot create an unnamed category. Try again.", "Ok");
                        }
                        else if (DUI.UIElementCategoryExists(NewCategoryName))
                        {
                            EditorUtility.DisplayDialog("Info", "A category named '" + NewCategoryName + "' already exists in the database. Try again.", "Ok");
                        }
                        else
                        {
                            DUI.CreateUIElementsCategory(NewCategoryName);
                            NewCategoryAnimBool.target = false;
                            RefreshUIElementsDatabase(true);
                        }
                    }
                    QUI.Space(1);
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonCancel), 20, 20))
                    {
                        NewCategoryName            = "";
                        NewCategoryAnimBool.target = false;
                    }
                }
                #endregion
                QUI.Space(342 * (1 - NewCategoryAnimBool.faded) * (1 - SearchPatternAnimBool.faded));
                #region Search
                if (!SearchPatternAnimBool.value)
                {
                    QUI.FlexibleSpace();
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSearch), 100 * (1 - NewCategoryAnimBool.faded), 20))
                    {
                        SearchPattern = string.Empty;
                        SearchPatternAnimBool.target = true;
                        NewCategoryAnimBool.target   = false;
                        foreach (string category in UIElementsDatabaseAnimBool.Keys)
                        {
                            UIElementsDatabaseAnimBool[category].target = true;
                        }
                    }
                }
                else
                {
                    NewCategoryAnimBool.target = false;
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonClearSearch), 100 * SearchPatternAnimBool.faded, 20))
                    {
                        SearchPattern = string.Empty;
                        SearchPatternAnimBool.target = false;
                        foreach (string category in UIElementsDatabaseAnimBool.Keys)
                        {
                            UIElementsDatabaseAnimBool[category].target = false;
                        }
                    }
                    GUILayout.Space(1);
                    SaveColors();
                    QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color);
                    SearchPattern = EditorGUILayout.TextField(SearchPattern, GUILayout.Width((sectionWidth - 210) * SearchPatternAnimBool.faded));
                    RestoreColors();
                    QUI.DrawTexture(DUIResources.pageButtonSearch.active, 100, 20);
                }
                #endregion
            }
            QUI.EndHorizontal();
            QUI.Space(16);
            if (UIElementsDatabaseAnimBool.Keys.Count == 0)
            {
                QUI.DrawTexture(DUIResources.pageImageEmptyDatabase.texture, 552, 256);
                QUI.BeginHorizontal(sectionWidth);
                {
                    QUI.FlexibleSpace();
                    QUI.Label("Add a new category to get started...", DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelNormalItalic));
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                return;
            }

            foreach (string category in DUI.UIElementsDatabase.Keys)
            {
                QUI.BeginHorizontal(sectionWidth);
                {
                    #region Button Bar
                    if (ButtonBar(category + (SearchPatternAnimBool.target ? "*" : ""), UIElementsDatabaseAnimBool[category], (sectionWidth - 203 * UIElementsDatabaseAnimBool[category].faded * (1 - SearchPatternAnimBool.faded))))
                    {
                        UIElementsDatabaseAnimBool[category].target = !UIElementsDatabaseAnimBool[category].target;
                    }

                    QUI.Space(-7);

                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSortAtoZ), 100 * UIElementsDatabaseAnimBool[category].faded * (1 - SearchPatternAnimBool.faded), 20))
                    {
                        DUI.UIElementsDatabase[category].RemoveEmpty();
                        DUI.UIElementsDatabase[category].Sort();
                    }

                    QUI.Space(1);

                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonDelete), 100 * UIElementsDatabaseAnimBool[category].faded * (1 - SearchPatternAnimBool.faded), 20))
                    {
                        if (EditorUtility.DisplayDialog("Delete the '" + category + "' category?", "Are you sure you want to proceed?\nOperation cannot be undone!", "Yes", "Cancel"))
                        {
                            DUI.DeleteUIElementsCategory(category);
                            RefreshUIElementsDatabase(true);
                            QUI.EndHorizontal();
                            break;
                        }
                    }
                    #endregion
                }
                QUI.EndHorizontal();
                if (!UIElementsDatabaseAnimBool.ContainsKey(category))
                {
                    RefreshUIElementsDatabase(true);
                }
                else
                {
                    if (QUI.BeginFadeGroup(UIElementsDatabaseAnimBool[category].faded))
                    {
                        QUI.BeginChangeCheck();
                        {
                            if (DUI.UIElementsDatabase[category] == null)
                            {
                                RefreshUIElementsDatabase();
                            }
                            else
                            {
                                DrawNamesList(DUI.UIElementsDatabase[category].data, PAGE_WIDTH - 200, "Category is empty...");
                            }
                        }
                        if (QUI.EndChangeCheck())
                        {
                            if (DUI.UIElementsDatabase[category] == null)
                            {
                                RefreshUIElementsDatabase();
                            }
                            else
                            {
                                EditorUtility.SetDirty(DUI.UIElementsDatabase[category]);
                            }
                        }
                        QUI.Space(8);
                    }
                    QUI.EndFadeGroup();
                }
                QUI.Space(2);
            }
        }
Ejemplo n.º 15
0
        void DrawUISounds()
        {
            QUI.DrawTexture(DUIResources.headerUISoundsDatabase.texture, 552, 64);
            float sectionWidth = PAGE_WIDTH - SIDE_BAR_SHADOW_WIDTH * 2;

            QUI.BeginHorizontal(sectionWidth);
            {
                #region New UISound
                if (!NewUISoundAnimBool.value)
                {
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonNewUISound), 100 * (1 - SearchPatternAnimBool.faded), 20))
                    {
                        NewUISoundName               = "";
                        NewUISoundAnimBool.target    = true;
                        SearchPatternAnimBool.target = false;
                    }
                }
                else
                {
                    SearchPatternAnimBool.target = false;
                    QUI.DrawTexture(DUIResources.pageButtonNewUISound.active, 100, 20);
                    QUI.Space(80);
                    SaveColors();
                    QUI.SetGUIBackgroundColor(DUIColors.GreenLight.Color);
                    NewUISoundName = EditorGUILayout.TextField(NewUISoundName, GUILayout.Width((sectionWidth - 149) * NewUISoundAnimBool.faded));
                    RestoreColors();
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonOk), 20, 20))
                    {
                        if (string.IsNullOrEmpty(NewUISoundName))
                        {
                            EditorUtility.DisplayDialog("Info", "Cannot create an unnamed ui sound. Try again.", "Ok");
                        }
                        else if (DUI.UISoundNameExists(NewUISoundName))
                        {
                            EditorUtility.DisplayDialog("Info", "An ui sound named '" + NewUISoundName + "' already exists in the database. Try again.", "Ok");
                        }
                        else
                        {
                            DUI.CreateUISound(NewUISoundName, soundTypeFilter);
                            NewUISoundAnimBool.target = false;
                            RefreshUISoundsDatabase(true);
                        }
                    }
                    QUI.Space(1);
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonCancel), 20, 20))
                    {
                        NewUISoundName            = "";
                        NewUISoundAnimBool.target = false;
                    }
                }
                #endregion
                QUI.Space(342 * (1 - NewUISoundAnimBool.faded) * (1 - SearchPatternAnimBool.faded));
                #region Search
                if (!SearchPatternAnimBool.value)
                {
                    QUI.FlexibleSpace();
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSearch), 100 * (1 - NewUISoundAnimBool.faded), 20))
                    {
                        SearchPattern = string.Empty;
                        SearchPatternAnimBool.target = true;
                        NewUISoundAnimBool.target    = false;
                    }
                }
                else
                {
                    NewUISoundAnimBool.target = false;
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonClearSearch), 100 * SearchPatternAnimBool.faded, 20))
                    {
                        SearchPattern = string.Empty;
                        SearchPatternAnimBool.target = false;
                    }
                    GUILayout.Space(1);
                    SaveColors();
                    QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color);
                    SearchPattern = EditorGUILayout.TextField(SearchPattern, GUILayout.Width((sectionWidth - 210) * SearchPatternAnimBool.faded));
                    RestoreColors();
                    QUI.DrawTexture(DUIResources.pageButtonSearch.active, 100, 20);
                }
                #endregion
            }
            QUI.EndHorizontal();
            QUI.Space(16);
            #region Filter
            QUI.BeginHorizontal(sectionWidth);
            {
                QUI.Space(8);
                QUI.FlexibleSpace();
                QUI.DrawTexture(DUIResources.pageButtonFilterHeader.texture, 302, 10);
                QUI.Space(302);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            QUI.Space(10);
            QUI.BeginHorizontal(sectionWidth);
            {
                QUI.Space(-2);
                QUI.FlexibleSpace();
                if (soundTypeFilter == SoundType.All)
                {
                    QUI.DrawTexture(DUIResources.pageButtonFilterAll.active, 100, 20);
                    QUI.Space(80);
                }
                else
                {
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonFilterAll), 100, 20))
                    {
                        soundTypeFilter = SoundType.All;
                    }
                }
                QUI.Space(1);
                if (soundTypeFilter == SoundType.UIButtons)
                {
                    QUI.DrawTexture(DUIResources.pageButtonFilterUIButton.active, 100, 20);
                    QUI.Space(80);
                }
                else
                {
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonFilterUIButton), 100, 20))
                    {
                        soundTypeFilter = SoundType.UIButtons;
                    }
                }
                QUI.Space(1);
                if (soundTypeFilter == SoundType.UIElements)
                {
                    QUI.DrawTexture(DUIResources.pageButtonFilterUIElement.active, 100, 20);
                    QUI.Space(80);
                }
                else
                {
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonFilterUIElement), 100, 20))
                    {
                        soundTypeFilter = SoundType.UIElements;
                    }
                }
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            #endregion
            QUI.Space(16);
            if (DUI.UISoundsDatabase.Count == 0)
            {
                QUI.DrawTexture(DUIResources.pageImageEmptyDatabase.texture, 552, 256);
                return;
            }
            QUI.DrawTexture(DUIResources.pageUISoundsTableTop.texture, 552, 12);
            for (int i = 0; i < DUI.UISoundsDatabase.Count; i++)
            {
                if (DUI.UISoundsDatabase[i] == null)
                {
                    continue;
                }
                if (soundTypeFilter == SoundType.UIButtons && DUI.UISoundsDatabase[i].soundType == SoundType.UIElements)
                {
                    continue;
                }
                if (soundTypeFilter == SoundType.UIElements && DUI.UISoundsDatabase[i].soundType == SoundType.UIButtons)
                {
                    continue;
                }

                QUI.BeginHorizontal(sectionWidth);
                {
                    if (SearchPatternAnimBool.target)//a search pattern has been entered in the search box
                    {
                        try
                        {
                            if (!Regex.IsMatch(DUI.UISoundsDatabase[i].soundName, SearchPattern, RegexOptions.IgnoreCase))
                            {
                                QUI.EndHorizontal();
                                continue; //this does not match the search pattern --> we do not show this name it
                            }
                        }
                        catch (Exception)
                        { }
                    }
                    DUI.UISoundsDatabase[i].soundType = (SoundType)EditorGUILayout.EnumPopup(DUI.UISoundsDatabase[i].soundType, GUILayout.Width(80));
                    if (SearchPatternAnimBool.target)
                    {
                        QUI.Label(DUI.UISoundsDatabase[i].soundName, DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelNormalItalic), 174);
                    }
                    else
                    {
                        QUI.Label(DUI.UISoundsDatabase[i].soundName, DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelNormal), 174);
                    }
#if dUI_MasterAudio
                    QUI.Label("Controlled by MasterAudio", DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelSmallItalic), 140);
#else
                    QUI.BeginChangeCheck();
                    {
                        DUI.UISoundsDatabase[i].audioClip = (AudioClip)EditorGUILayout.ObjectField("", DUI.UISoundsDatabase[i].audioClip, typeof(AudioClip), false, GUILayout.Width(140));
                    }
                    if (QUI.EndChangeCheck())
                    {
                        Undo.RecordObject(DUI.DUISettings, "Updated UISound");
                        EditorUtility.SetDirty(DUI.UISoundsDatabase[i]);
                        AssetDatabase.SaveAssets();
                    }
#endif
                    QUI.Space(50 * SearchPatternAnimBool.faded);
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonPlay), 20, 20))
                    {
                        DUIUtils.PreviewSound(DUI.UISoundsDatabase[i].soundName);
                    }
                    QUI.Space(1);
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonStop), 20, 20))
                    {
                        DUIUtils.StopSoundPreview(DUI.UISoundsDatabase[i].soundName);
                    }
                    QUI.Space(1);
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonDelete), 100 * (1 - SearchPatternAnimBool.faded), 20))
                    {
                        if (EditorUtility.DisplayDialog("Delete the '" + DUI.UISoundsDatabase[i].soundName + "' ui sound?", "Are you sure you want to proceed?\nOperation cannot be undone!", "Yes", "Cancel"))
                        {
                            DUI.DeleteUISound(DUI.UISoundsDatabase[i].soundName);
                            RefreshUISoundsDatabase(true);
                            QUI.EndHorizontal();
                            continue;
                        }
                    }
                }
                QUI.EndHorizontal();
                QUI.Space(2);
            }
            QUI.Space(-2);
            QUI.DrawTexture(DUIResources.pageUISoundsTableBottom.texture, 552, 12);
        }