static public void StopMusic() { if (!m_bMusicInited) { return; } if (!m_bMusicInited || null == m_MusicPlayer || null == m_MusicPlayer.SoundPlayer) { return; } if (m_MusicPlayer.SoundPlayer.isPlaying) { m_MusicPlayer.SoundPlayer.Stop(); } //if( Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer ) //{ // if( null != m_MusicPlayer.SoundObj ) // { // GameObject.DestroyImmediate( m_MusicPlayer.SoundObj , true ); //} //} MusicAssetMgr.DeleteAsset(m_MusicPlayer.szName, true); m_MusicPlayer.SoundPlayer.clip = null; m_MusicPlayer.SoundObj = null; m_MusicPlayer.szName = ""; }
static public void SetStopMusic() { PlayerPrefs.SetInt("settingMusic", 1); settingDirty = true; if (!m_bMusicInited || null == m_MusicPlayer || null == m_MusicPlayer.SoundPlayer) { return; } m_MusicPlayer.SoundPlayer.Stop(); /*if( Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer ) * { * if( null != m_MusicPlayer.SoundObj ) * { * GameObject.DestroyImmediate( m_MusicPlayer.SoundObj , true ); * } * } */ MusicAssetMgr.DeleteAsset(m_MusicPlayer.szName, true); m_MusicPlayer.SoundPlayer.clip = null; m_MusicPlayer.SoundObj = null; m_MusicPlayer.szName = ""; }
static public void PlayMusicCallBack(AssetBundle AssetData, ParamData paramData) { if (null == AssetData || null == AssetData.mainAsset) { MusicAssetMgr.DeleteAsset(AssetData, true); return; } //Delete Asset and Play new Music if (null != paramData) { if (null != m_MusicPlayer.SoundPlayer) { StopMusic(); AudioClip Source = AssetData.mainAsset as AudioClip; m_MusicPlayer.SoundObj = Source; m_MusicPlayer.SoundPlayer.clip = Source; m_MusicPlayer.SoundPlayer.volume = SOUNDVOLME; m_MusicPlayer.SoundPlayer.loop = paramData.bParam; m_MusicPlayer.szName = paramData.szAssetName; m_MusicPlayer.SoundPlayer.Play(); } } }