void LoadSoundAssetAndPlay(int soundId) { if (soundId == 0) { return; } SoundTableSetting soundTable = SoundTableSettings.Get(soundId); string path = string.Format("Sound/{0}{1}", soundTable.Path, (ResourceManager.EditorMode ? "." + soundTable.Extension : ResourceManager.BUNDLE_SUFFIX)); ResourceManager.LoadSound(path, LoadSoundAssetSuccess, LoadSoundAssetFaild, soundId, soundTable); }
//public IEnumerator Init() //{ // ResourceManager.LoadAudioMixer("Sound/Mixer/Main"); // allMixGroup //} public void Play(int soundId) { if (soundId == 0) { return; } SoundTableSetting soundTable = SoundTableSettings.Get(soundId); if (soundTable == null) { Debug.LogError("soundtable doesn't exist id = " + soundId); return; } SoundGroup soundGroup = dicSoundGroups[soundTable.Group]; if (soundGroup == null) { Debug.LogError("soundGroup [" + soundTable.Group + "] doesn't exist!id = " + soundId); return; } if (soundGroup.Name == VOICE_GROUP_KEY) { if (currentVoice == 0) { currentVoice = soundId; LoadSoundAssetAndPlay(soundId); } else { queueVoice.Clear(); queueVoice.Enqueue(soundId); } return; } LoadSoundAssetAndPlay(soundId); }