void DrawSoundsDatabase(float width) { DrawNewUISoundAndSearch(width); QUI.Space(SPACE_8); DrawUISoundsFilterButtons(width); QUI.Space(SPACE_8); for (int i = 0; i < DUIData.Instance.DatabaseUISounds.sounds.Count; i++) { if (DUIData.Instance.DatabaseUISounds.sounds[i] == null) { continue; } if (WindowSettings.selectedUISoundsFilter == SoundType.UIButtons && DUIData.Instance.DatabaseUISounds.sounds[i].soundType == SoundType.UIElements) { continue; } if (WindowSettings.selectedUISoundsFilter == SoundType.UIElements && DUIData.Instance.DatabaseUISounds.sounds[i].soundType == SoundType.UIButtons) { continue; } QUI.BeginHorizontal(width, 20); { if (SearchPatternAnimBool.target)//a search pattern has been entered in the search box { try { if (!Regex.IsMatch(DUIData.Instance.DatabaseUISounds.sounds[i].soundName, SearchPattern, RegexOptions.IgnoreCase)) { QUI.EndHorizontal(); continue; //this does not match the search pattern --> we do not show this name it } } catch (Exception) { } } QUI.Space(-1); QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, SearchPatternAnimBool.target ? QColors.Color.Orange : QColors.Color.Gray), width + 2, 20); QUI.Space(-2); QUI.Space(-width); SoundType soundType = DUIData.Instance.DatabaseUISounds.sounds[i].soundType; QUI.BeginChangeCheck(); soundType = (SoundType)EditorGUILayout.EnumPopup(soundType, GUILayout.Width(PAGE_UISOUNDS_SOUNDTYPE_BUTTON_WIDTH)); if (QUI.EndChangeCheck()) { Undo.RecordObject(DUIData.Instance, "UpdateSoundType"); DUIData.Instance.DatabaseUISounds.sounds[i].soundType = soundType; QUI.SetDirty(DUIData.Instance.DatabaseUISounds.sounds[i]); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); } QLabel.text = DUIData.Instance.DatabaseUISounds.sounds[i].soundName; #if dUI_MasterAudio QLabel.text = "Controlled by MasterAudio"; #endif QUI.Label(QLabel.text, Style.Text.Normal, (width - PAGE_UISOUNDS_SOUNDTYPE_BUTTON_WIDTH - PAGE_UISOUNDS_HORIZONTAL_SPACE * 3 - PAGE_UISOUNDS_BUTTONS_WIDTH * (1 - SearchPatternAnimBool.faded) - 16) * PAGE_UISOUNDS_SOUNDNAME_FIELD_WIDTH_PERCENT); AudioClip audioClip = DUIData.Instance.DatabaseUISounds.sounds[i].audioClip; QUI.BeginChangeCheck(); audioClip = (AudioClip)EditorGUILayout.ObjectField("", audioClip, typeof(AudioClip), false, GUILayout.Width((width - PAGE_UISOUNDS_SOUNDTYPE_BUTTON_WIDTH - PAGE_UISOUNDS_HORIZONTAL_SPACE * 3 - PAGE_UISOUNDS_BUTTONS_WIDTH * (1 - SearchPatternAnimBool.faded) - 16) * PAGE_UISOUNDS_AUDIOCLIP_FIELD_WIDTH_PERCENT)); if (QUI.EndChangeCheck()) { Undo.RecordObject(DUIData.Instance, "UpdateAudioClipReferene"); DUIData.Instance.DatabaseUISounds.sounds[i].audioClip = audioClip; QUI.SetDirty(DUIData.Instance.DatabaseUISounds.sounds[i]); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); } if (SearchPatternAnimBool.faded < 0.6f) { QUI.Space(PAGE_UISOUNDS_HORIZONTAL_SPACE); if (QUI.ButtonPlay()) { DUIUtils.PreviewSound(DUIData.Instance.DatabaseUISounds.sounds[i].soundName); } } if (SearchPatternAnimBool.faded < 0.4f) { QUI.Space(PAGE_UISOUNDS_HORIZONTAL_SPACE); if (QUI.ButtonStop()) { DUIUtils.StopSoundPreview(DUIData.Instance.DatabaseUISounds.sounds[i].soundName); } QUI.Space(PAGE_UISOUNDS_HORIZONTAL_SPACE); } if (SearchPatternAnimBool.faded < 0.2f) { if (QUI.ButtonCancel()) { if (EditorUtility.DisplayDialog("Delete the '" + DUIData.Instance.DatabaseUISounds.sounds[i].soundName + "' UISound?", "Are you sure you want to proceed?" + "\n\n" + "Operation cannot be undone!", "Yes", "Cancel")) { DUIData.Instance.DatabaseUISounds.DeleteUISound(DUIData.Instance.DatabaseUISounds.sounds[i].soundName); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); QUI.EndHorizontal(); continue; } } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_2); } }