void LoadEffectAssetFinish(string path, Object obj, object param1 = null, object param2 = null, object param3 = null) { uint tempCrc = CRC32.GetCRC32(path); AudioObj tempObj = AudioObjClassPool.Spawn(true); tempObj.m_AudioClip = obj as AudioClip; tempObj.m_ClearScene = (bool)param1; AudioAssetDic.Add(tempCrc, tempObj); EffectAudioPrefab tempEff = param3 as EffectAudioPrefab; tempEff.m_AudioSou.clip = tempObj.m_AudioClip; tempEff.m_AudioSou.volume = EffectAudioVolume; tempEff.m_AudioSou.loop = (bool)param2; if (EffectAudioVolume > 0f) { tempEff.m_AudioSou.Play(); } else { tempEff.m_AudioSou.Stop(); } tempEff.m_UsingBoo = true; EffectAudioDic.Add(tempEff.m_guid, tempEff); CoroutineMgr.Instance.StartCoroutine(tempEff.m_guid, EffectAudioTimerCor(tempEff.m_guid)); }
public void ClearCache() { List <uint> tempClearKeyList = new List <uint>(); foreach (uint tempKey in AudioAssetDic.Keys) { AudioObj tempAudioObj = AudioAssetDic[tempKey]; if (tempAudioObj.m_ClearScene) { tempClearKeyList.Add(tempKey); } } foreach (uint tempKey in tempClearKeyList) { AudioObj tempAudioObj; if (AudioAssetDic.TryGetValue(tempKey, out tempAudioObj) && tempAudioObj != null) { ResourcesMgr.Instance.ReleaseResource(tempAudioObj.m_AudioClip, true); tempAudioObj.Reset(); AudioObjClassPool.Recycle(tempAudioObj); AudioAssetDic.Remove(tempKey); } } tempClearKeyList.Clear(); }
void PreLoadFinish(string path, Object obj, object param1 = null, object param2 = null, object param3 = null) { uint tempCrc = CRC32.GetCRC32(path); AudioObj tempObj = AudioObjClassPool.Spawn(true); tempObj.m_AudioClip = obj as AudioClip; tempObj.m_ClearScene = (bool)param1; AudioAssetDic.Add(tempCrc, tempObj); }
void LoadUiAssetFinish(string path, Object obj, object param1 = null, object param2 = null, object param3 = null) { uint tempCrc = CRC32.GetCRC32(path); AudioObj tempObj = AudioObjClassPool.Spawn(true); tempObj.m_AudioClip = obj as AudioClip; tempObj.m_ClearScene = (bool)param1; AudioAssetDic.Add(tempCrc, tempObj); uiAudio.clip = tempObj.m_AudioClip; uiAudio.volume = EffectAudioVolume; uiAudio.loop = (bool)param2; if (EffectAudioVolume > 0f) { bgAudio.Play(); } else { bgAudio.Stop(); } }
void OnLoadEffectAssetFinish(string path, Object obj, object param1 = null, object param2 = null, object param3 = null) { uint tempCrc = CRC32.GetCRC32(path); AudioObj tempObj = AudioObjClassPool.Spawn(true); tempObj.m_AudioClip = obj as AudioClip; tempObj.m_ClearScene = (bool)param1; AudioAssetDic.Add(tempCrc, tempObj); EffectAudioPrefab tempEff = param3 as EffectAudioPrefab; tempEff.m_AudioSou.clip = tempObj.m_AudioClip; tempEff.m_AudioSou.volume = EffectAudioVolume; if (EffectAudioVolume > 0f) { tempEff.m_AudioSou.Play(); } else { tempEff.m_AudioSou.Stop(); } tempEff.m_UsingBoo = true; }