Exemplo n.º 1
0
 private void RefreshUISoundsDatabase(bool forcedRefresh = false)
 {
     if (DUI.UISoundsDatabase == null || forcedRefresh)
     {
         EditorUtility.DisplayProgressBar("Reloading Data", "Refreshing the UISounds Database...", 0.5f);
         DUI.RefreshUISoundsDatabase();
     }
     EditorUtility.ClearProgressBar();
 }
Exemplo n.º 2
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
        }