Example #1
0
    public string getBGM(SceneBGM bgm)
    {
        string    fileName = string.Empty;
        SoundData sound    = null;

        if (soundConfig.TryGetValue((int)bgm, out sound))
        {
            fileName = sound.name;
        }
        return(fileName);
    }
Example #2
0
 /// <summary>
 /// 播放背景音乐
 /// </summary>
 public void BGMPlay(SceneBGM BGM)
 {
     if (!bMute)
     {
         string fileName = getBGM(BGM);
         if (string.IsNullOrEmpty(fileName))
         {
             ConsoleEx.DebugLog("Can't find Button Sound Effect. Button Type = " + BGM.ToString());
         }
         else
         {
             AudioClip clip = null;
             clip = PrefabLoader.loadFromUnPack(AUDIO_ROOT_PATH + fileName, false, cached) as AudioClip;
             Core.SoundEng.PlayClipForce(clip, AUDIO_BMG, true, 0.8f);
         }
     }
 }