static public void PlaySoundCallBack(AssetBundle AssetData, ParamData paramData) { if (null == AssetData || null == AssetData.mainAsset) { SoundAssetMgr.DeleteAsset(AssetData, true); return; } AudioClip SoundObj = AssetData.mainAsset as AudioClip; SoundPlayInfo MaxTimeSound = GetMaxTimeInfo(); if (null != SoundObj) { if (null != MaxTimeSound.SoundPlayer) { MaxTimeSound.SoundPlayer.Stop(); } if (null != MaxTimeSound) { SoundAssetMgr.DeleteAsset(MaxTimeSound.szName, true); } if (null != paramData) { MaxTimeSound.szName = paramData.szAssetName; MaxTimeSound.fTime = Time.realtimeSinceStartup; MaxTimeSound.SoundObj = SoundObj; MaxTimeSound.SoundPlayer.clip = SoundObj; MaxTimeSound.SoundPlayer.volume = SOUNDVOLME; MaxTimeSound.SoundPlayer.loop = paramData.bParam; MaxTimeSound.SoundPlayer.Play(); } } }
static private void InitPlayMusic() { m_bMusicInited = true; m_MusicPlayer = new SoundPlayInfo(ESoundType.SOUNDTYPE_MUSIC); // GameObject Obj = GameObject.Find("/CommonScript/SoundPlay/MusicPlayer"); if (null != Obj) { m_MusicPlayer.SoundPlayer = Obj.GetComponent <AudioSource>(); } }
static private void InitPlaySound() { m_bSoundInited = true; m_SoundPlayers = new SoundPlayInfo[MAX_KEEP_SOUND]; for (int iLoop = 0; iLoop < MAX_KEEP_SOUND; ++iLoop) { m_SoundPlayers[iLoop] = new SoundPlayInfo(ESoundType.SOUNDTYPE_SOUNND); string szObjName = "/CommonScript/SoundPlay/SoundPlayer/SoundPlayer" + iLoop.ToString(); GameObject Obj = GameObject.Find(szObjName); if (null != Obj) { m_SoundPlayers[iLoop].SoundPlayer = Obj.GetComponent <AudioSource>(); } } string yyp = "/CommonScript/SoundPlay/SoundPlayer/YuyinPlayer"; GameObject yyObj = GameObject.Find(yyp); if (yyObj != null) { ChatSystem.audios = yyObj.GetComponent <AudioSource>(); } }