/// <summary> /// 自动播放语音 /// </summary> protected void SlefPlayVoice() { //NGUIDebug.Log("自动播放语音 IsAutoPlayVoice : " + IsAutoPlayVoice + " , InterruptVoiceSelfPlaying:" + InterruptVoiceSelfPlaying + " , IsPausePlayVoice : " + IsPausePlayVoice); //if (IsAutoPlayVoice && !InterruptVoiceSelfPlaying && !IsPausePlayVoice) if (!InterruptVoiceSelfPlaying && !IsPausePlayVoice) { if (voiceList.Count > 0) { string urlPath = voiceList[0].voicePath; string time = voiceList[0].accurateTime; curVoiceInfo = voiceList[0]; curVoiceInfo.AutoPlayVoice = true; YvVoiceSdk.YvVoicePlayVoiceCallBack(urlPath, time, () => { AutoPlayNextVoice(); }); } else { IsAutoPlayingVoice = false; } } }
/// <summary> /// 播放语音 /// </summary> /// <param name="_go"></param> void PlayVoice(GameObject _go) { //重新播放已经播放了的或点击自己的声音 if (!curInfo.voiceRed || curInfo.senderID == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID) { PlayAni(); curInfo.voiceRed = false; if (voiceRedObj != null) { voiceRedObj.SetActive(curInfo.voiceRed); } GameCenter.chatMng.InterruptVoiceSelfPlaying = true; //Debug.Log("播放语音成功"); if (curInfo.voicePath != string.Empty) { YvVoiceSdk.YvVoicePlayVoiceCallBack(curInfo.voicePath, curInfo.accurateTime, () => { StopAni(); }); } } else//点击没有播放的开启自动播放 { if (GameCenter.chatMng.InterruptVoiceSelfPlaying) { PlayAni(); curInfo.voiceRed = false; if (voiceRedObj != null) { voiceRedObj.SetActive(curInfo.voiceRed); } if (curInfo.voicePath != string.Empty) { YvVoiceSdk.YvVoicePlayVoiceCallBack(curInfo.voicePath, curInfo.accurateTime, () => { StopAni(); }); } } else { if (GameCenter.chatMng.CurAutoPlayType == CurAutoPlayVoiceType.MAINCHAT) { GameCenter.chatMng.SetCurAutoPlayType(curInfo);//主界面自动播放切换为当前聊天界面自动播放 } else { PlayAni(); curInfo.voiceRed = false; if (voiceRedObj != null) { voiceRedObj.SetActive(curInfo.voiceRed); } GameCenter.chatMng.InterruptVoiceSelfPlaying = true; if (curInfo.voicePath != string.Empty) { YvVoiceSdk.YvVoicePlayVoiceCallBack(curInfo.voicePath, curInfo.accurateTime, () => { StopAni(); }); } } } } }