/// <summary>
 /// 播放背景音乐
 /// </summary>
 /// <param name="canPlay"></param>
 public void PlayBacksound(string name, bool canPlay)
 {
     if (audio.clip != null)
     {
         if (name.IndexOf(audio.clip.name) > -1)
         {
             if (!canPlay)
             {
                 audio.Stop();
                 audio.clip = null;
                 QUtil.ClearMemory();
             }
             return;
         }
     }
     if (canPlay)
     {
         audio.loop = true;
         audio.clip = LoadAudioClip(name);
         audio.Play();
     }
     else
     {
         audio.Stop();
         audio.clip = null;
         QUtil.ClearMemory();
     }
 }
Example #2
0
        //-----------------------------------------------------------------
        protected void OnDestroy()
        {
            ClearClick();
#if ASYNC_MODE
            string abName = name.ToLower().Replace("panel", "");
            ResManager.UnloadAssetBundle(abName + AppConst.ExtName);
#endif
            QUtil.ClearMemory();
            Debug.Log("~" + name + " was destroy!");
        }