void OnApplyMessageKeyComplete(IGCloudVoice.GCloudVoiceCompleteCode code) { if (onAction != null) { onAction.Call("onAction", JsonUtility.ToJson(new GVoiceManagerAction() { eventName = "OnApplyMessageKeyComplete", code = code.ToString() })); } if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_MESSAGE_KEY_APPLIED_SUCC) { Debug.Log("OnApplyMessageKeyComplete succ11"); if (onInitComplete != null) { onInitComplete(string.Empty); } } else { Debug.Log("OnApplyMessageKeyComplete error"); if (onInitComplete != null) { onInitComplete(code + ""); } } }
private void PlayRecordFileComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath) { //LOG_STRING("OnPlayRecordFilComplete c# callback"); int retCode = 0; if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_PLAYFILE_DONE) { //LOG_STRING("OnPlayRecordFilComplete succ, filepath:" + filepath); } else { retCode = (int)code; //LOG_STRING(string.Format("OnPlayRecordFilComplete error code: {0}, filepath: {1}", code, filepath)); } //call lua IntPtr L = LuaScriptMgr.Instance.GetL(); if (L != IntPtr.Zero) { int oldTop = LuaDLL.lua_gettop(L); LuaDLL.lua_getglobal(L, "Voice_OnPlayRecordFileComplete"); if (!LuaDLL.lua_isnil(L, -1)) { LuaDLL.lua_pushinteger(L, retCode); LuaDLL.lua_pushstring(L, filepath); if (LuaDLL.lua_pcall(L, 2, 0, 0) != 0) { HobaDebuger.LogLuaError(LuaDLL.lua_tostring(L, -1)); } } LuaDLL.lua_settop(L, oldTop); } }
private void OnApplyMessageKeyComplete(IGCloudVoice.GCloudVoiceCompleteCode code) { //LOG_STRING("OnApplyMessageKeyComplete c# callback"); int retCode = 0; if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_MESSAGE_KEY_APPLIED_SUCC) { _bIsGetAuthKey = true; //LOG_STRING("OnApplyMessageKeyComplete succ11"); } else { retCode = (int)code; } //call lua IntPtr L = LuaScriptMgr.Instance.GetL(); if (L != IntPtr.Zero) { int oldTop = LuaDLL.lua_gettop(L); LuaDLL.lua_getglobal(L, "Voice_OnApplyMessageKeyComplete"); if (!LuaDLL.lua_isnil(L, -1)) { LuaDLL.lua_pushinteger(L, retCode); if (LuaDLL.lua_pcall(L, 1, 0, 0) != 0) { HobaDebuger.LogLuaError(LuaDLL.lua_tostring(L, -1)); } } LuaDLL.lua_settop(L, oldTop); } }
void OnDownloadRecordFileComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { if (onAction != null) { onAction.Call("onAction", JsonUtility.ToJson(new GVoiceManagerAction() { eventName = "OnDownloadRecordFileComplete", code = code.ToString(), data = filepath + "|" + fileid })); } Debug.Log("OnDownloadRecordFileComplete c# callback"); if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_DOWNLOAD_RECORD_DONE) { Debug.Log("OnDownloadRecordFileComplete succ, filepath:" + filepath + " fileid:" + fileid); if (onDownloadRecordFileComplete != null) { onDownloadRecordFileComplete(filepath, fileid); } //暂停背景音乐 } else { Debug.Log("OnDownloadRecordFileComplete error"); } }
void OnUploadReccordFileComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { if (onAction != null) { onAction.Call("onAction", JsonUtility.ToJson(new GVoiceManagerAction() { eventName = "OnUploadReccordFileComplete", code = code.ToString(), data = fileid })); } Debug.Log("OnUploadReccordFileComplete c# callback" + code + " filepath " + filepath + " fileid " + fileid); if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_UPLOAD_RECORD_DONE) { Debug.Log("OnUploadReccordFileComplete succ11"); //int ret = m_voiceengine.DownloadRecordedFile(m_fileid, m_downloadpath, 60000); //广播给其他玩家 if (onUploadReccordFileComplete != null) { onUploadReccordFileComplete(fileid); } } else { //如果上传失败了需要 Debug.Log("OnUploadReccordFileComplete error"); } }
void OnPlayRecordFilComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath) { if (onAction != null) { onAction.Call("onAction", JsonUtility.ToJson(new GVoiceManagerAction() { eventName = "OnPlayRecordFilComplete", code = code.ToString(), data = filepath })); } Debug.Log("OnPlayRecordFilComplete c# callback"); if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_PLAYFILE_DONE) { if (onPlayRecordFilComplete != null) { onPlayRecordFilComplete(filepath); } Debug.Log("OnPlayRecordFilComplete succ, filepath:" + filepath); } else { Debug.Log("OnPlayRecordFilComplete error"); } }
public void OnQuitRoomComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string roomName, int memberID) { Debug.Log(string.Format("GVoiceManger OnQuitRoomComplete {0}/{1}/{2}", code, roomName, memberID)); if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_QUITROOM_SUCC) { GameCmd.stVoiceChatOperChatUserCmd_CS cmd = new GameCmd.stVoiceChatOperChatUserCmd_CS(); if (roomName.StartsWith("team")) { QuitRoomAudioUpdate(); cmd.chtype = GameCmd.VoChatType.VoChatType_Team; //退出游戏的时候退出聊天室 回调没有回来 重新登入游戏 回调回再次回来 if (JoinRoomType != JoinRoomEnum.None) { PreJoinRoomType = JoinRoomEnum.Team; } if (DataManager.Manager <TeamDataManager>().IsJoinTeam) { cmd.posid = (uint)memberID; cmd.optype = GameCmd.VoChatOpType.VoChatOpType_Leave; NetService.Instance.Send(cmd); } } else if (roomName.StartsWith("national")) { cmd.chtype = GameCmd.VoChatType.VoChatType_Clan; if (JoinRoomType != JoinRoomEnum.None) { PreJoinRoomType = JoinRoomEnum.Nation; } if (DataManager.Manager <ClanManger>().IsJoinClan) { cmd.posid = (uint)memberID; cmd.optype = GameCmd.VoChatOpType.VoChatOpType_Leave; NetService.Instance.Send(cmd); } } else { QuitRoomAudioUpdate(); } JoinRoomType = JoinRoomEnum.None; JoinRoomName = ""; Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CHAT_LEVELROOM, null); if (m_onQuitRoom != null) { m_onQuitRoom(true); } } else { QuitRoom(roomName); } IsOpenMic = false; m_strLastJoinRoomName = ""; }
/// <summary> /// 退出房间回调 /// </summary> /// <param name="code"></param> /// <param name="roomName"></param> /// <param name="memberID"></param> private void OnExitRoom(IGCloudVoice.GCloudVoiceCompleteCode code, string roomName, int memberID) { result.text += string.Format("\nOnExitRoom ---> code: {0}, roomName: {1}, memberID: {2}", code, roomName, memberID); m_voiceengine.OnJoinRoomComplete -= OnJoinRoom; m_voiceengine.OnQuitRoomComplete -= OnExitRoom; m_voiceengine.OnMemberVoice -= OnMemberVoice; }
private void OnApplyMessageKeyCompleteHandle(IGCloudVoice.GCloudVoiceCompleteCode code) { if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_MESSAGE_KEY_APPLIED_SUCC) { Debug.Log("OnApplyMessageKeyComplete succ11"); } else { Debug.Log("OnApplyMessageKeyComplete error"); } }
void onPlayRecordFilComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath) { if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_PLAYFILE_DONE) { Debug.Log("OnPlayRecordFilComplete succ, filepath:" + filepath); } else { Debug.Log("OnPlayRecordFilComplete error"); } isPlaySucc = true; downloadRecord(); }
private void OnApplyMessageKeyCompleteHandle(IGCloudVoice.GCloudVoiceCompleteCode code) { Debug.Log("OnApplyMessageKeyComplete c# callback"); s_strLog += "\r\n" + "OnApplyMessageKeyComplete ret=" + code; if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_MESSAGE_KEY_APPLIED_SUCC) { bIsGetAuthKey = true; Debug.Log("OnApplyMessageKeyComplete succ11"); } else { Debug.Log("OnApplyMessageKeyComplete error"); } // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, code.ToString()); }
void onUploadReccordFileComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_UPLOAD_RECORD_DONE) { Debug.Log("OnUploadReccordFileComplete succ, filepath:" + filepath + " fileid len=" + fileid.Length + " fileid:" + fileid + " fileid len=" + fileid.Length); XLua.LuaTable tab = AppMng.luaEnv.NewTable(); tab.Set <string, string> ("fileid", fileid); EventTool.Run("niuniu", "playroom.sendchat", tab); } else { Debug.Log("OnUploadReccordFileComplete error"); } }
public void OnPlayRecordFilCompletehandler(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath) { Debug.Log(string.Format(" GVoiceManger 播放语音 {0} / {1} ", code, filepath)); if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_PLAYFILE_DONE) { //string filePath = string.Format("{0}/{1}.amr", VoiceDataPath, strFileName); string path = filepath.Replace(VoiceDataPath + "/", ""); path = path.Replace(".amr", ""); m_bPlayRecordFile = false; Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CHAT_VOICE_PLAY, new Client.stVoicePlay() { fileId = path }); } SetRealTimeModel(); }
private void OnPlayRecordFilCompleteHandle(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath) { Debug.Log("OnPlayRecordFilComplete c# callback"); s_strLog += "\r\n" + "OnPlayRecordFilComplete ret=" + code + " filepath:" + filepath; if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_PLAYFILE_DONE) { Debug.Log("OnPlayRecordFilComplete succ, filepath:" + filepath); } else { Debug.Log("OnPlayRecordFilComplete error"); } EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent <string, bool>(EventId.UIFrameWork_Set_Voice_Active, "", false); isCanPlayRecordedFile = true; }
void onDownloadReccordFileComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_DOWNLOAD_RECORD_DONE) { Debug.Log("OnDownloadRecordFileComplete succ, filepath:" + filepath + " fileid:" + fileid); GCloudVoiceErr err = (GCloudVoiceErr)m_voiceengine.PlayRecordedFile(filepath); if (err != GCloudVoiceErr.GCLOUD_VOICE_SUCC) { Debug.LogError("[GVoiceMng.onDownloadReccordFileComplete]PlayRecordedFile:" + err); isPlaySucc = true; downloadRecord(); } } else { Debug.Log("OnDownloadRecordFileComplete error"); } }
private void OnUploadReccordFileCompleteHandle(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_UPLOAD_RECORD_DONE) { m_fileid = fileid; SocketClient.Instance.PlayerChat(ChatState.Voice, m_fileid); s_strLog += "\r\nUpload file to svr succ\r\nstart down record file from svr..."; // m_voiceengine.PlayRecordedFile(m_recordpath); _fileIDDicUUid.Add(m_fileid, MainManager.Instance.playerSelfInfo.unionID); _fileIDArr.Add(m_fileid); } else { s_strLog += "OnUploadReccordFileComplete err, filepath:" + filepath + " fileid:" + fileid; Debug.Log("OnUploadReccordFileComplete error"); } // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, code.ToString() + "OnUploadReccordFileCompleteHandle"); }
private void OnDownloadRecordFileCompleteHandle(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { Debug.Log("OnDownloadRecordFileComplete c# callback"); //s_strLog += "\r\n"+"OnDownloadRecordFileComplete ret="+code+" filepath:"+filepath+" fielid:"+fileid; if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_DOWNLOAD_RECORD_DONE) { Debug.Log("OnDownloadRecordFileComplete succ, filepath:" + filepath + " fileid:" + fileid); s_strLog += "\r\nDownload record file from svr succ"; // btn_svr.SetActive(true); // Click_btnPlayReocrdFile(fileid); _fileIDArr.Add(fileid); // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent<string>(EventId.UIFrameWork_Bug, "OnDownloadRecordFileComplete"); } else { Debug.Log("OnDownloadRecordFileComplete error"); } }
private void OnDownloadRecordFileComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { //LOG_STRING("OnDownloadRecordFileComplete c# callback"); int retCode = 0; if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_DOWNLOAD_RECORD_DONE) { //LOG_STRING("OnDownloadRecordFileComplete succ, filepath:" + filepath + " fileid:" + fileid); } else { retCode = (int)code; //LOG_STRING(string.Format("OnDownloadRecordFileComplete error code: {0}, filepath: {1}, fileid: {2}", code, filepath, fileid)); } FileIdDownloadingSet.Remove(fileid); //call lua IntPtr L = LuaScriptMgr.Instance.GetL(); if (L != IntPtr.Zero) { int oldTop = LuaDLL.lua_gettop(L); LuaDLL.lua_getglobal(L, "Voice_OnDownloadRecordFileComplete"); if (!LuaDLL.lua_isnil(L, -1)) { LuaDLL.lua_pushinteger(L, retCode); LuaDLL.lua_pushstring(L, filepath); LuaDLL.lua_pushstring(L, fileid); if (LuaDLL.lua_pcall(L, 3, 0, 0) != 0) { HobaDebuger.LogLuaError(LuaDLL.lua_tostring(L, -1)); } } LuaDLL.lua_settop(L, oldTop); } }
private void OnSpeechToTextComplete(IGCloudVoice.GCloudVoiceCompleteCode code, string fileID, string result) { int retCode = (int)code; //call lua IntPtr L = LuaScriptMgr.Instance.GetL(); if (L != IntPtr.Zero) { int oldTop = LuaDLL.lua_gettop(L); LuaDLL.lua_getglobal(L, "Voice_OnSpeechToTextComplete"); if (!LuaDLL.lua_isnil(L, -1)) { LuaDLL.lua_pushinteger(L, retCode); LuaDLL.lua_pushstring(L, fileID); LuaDLL.lua_pushstring(L, result); if (LuaDLL.lua_pcall(L, 3, 0, 0) != 0) { HobaDebuger.LogLuaError(LuaDLL.lua_tostring(L, -1)); } } LuaDLL.lua_settop(L, oldTop); } }
/// <summary> /// 加入房间回调 /// </summary> /// <param name="code"></param> /// <param name="roomName"></param> /// <param name="memberID"></param> private void OnJoinRoom(IGCloudVoice.GCloudVoiceCompleteCode code, string roomName, int memberID) { result.text += string.Format("\nOnJoinRoom ---> code: {0}, roomName: {1}, memberID: {2}", code, roomName, memberID); }
//回调 //----------------------------------------------------------------------------------------------- /// <summary> /// 语音消息安全密钥key 回调 /// </summary> /// <param name="code"></param> public void OnApplyMessageKeyCompleteHandler(IGCloudVoice.GCloudVoiceCompleteCode code) { Debug.Log(string.Format(" GVoiceManger OnApplyMessageKeyCompleteHandler {0}", code)); }
/// 进入房间回调 /// </summary> /// <param name="code"></param> /// <param name="roomName"></param> /// <param name="memberID"></param> /// public void OnJoinRoomCompleteHandler(IGCloudVoice.GCloudVoiceCompleteCode code, string roomName, int memberID) { Debug.Log(string.Format("GVoiceManger OnJoinRoomCompleteHandler {0}/{1}/{2}", code, roomName, memberID)); if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_JOINROOM_SUCC) { if (roomName.StartsWith("team")) { JoinRoomAudioUpdate(); } else if (roomName.StartsWith("national")) { } else { JoinRoomAudioUpdate(); } } if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_JOINROOM_SUCC) { m_nJoinRoomErrorTime = 0; this.JoinRoomName = roomName; this.MemberId = memberID; GameCmd.stVoiceChatOperChatUserCmd_CS cmd = new GameCmd.stVoiceChatOperChatUserCmd_CS(); if (roomName.StartsWith("team")) { cmd.chtype = GameCmd.VoChatType.VoChatType_Team; JoinRoomType = JoinRoomEnum.Team; } else if (roomName.StartsWith("national")) { cmd.chtype = GameCmd.VoChatType.VoChatType_Clan; JoinRoomType = JoinRoomEnum.Nation; } cmd.posid = (uint)memberID; cmd.optype = GameCmd.VoChatOpType.VoChatOpType_Add; NetService.Instance.Send(cmd); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CHAT_JOINROOM, new Client.stVoiceJoinRoom() { succ = true, memberid = memberID, name = roomName }); } else if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_JOINROOM_TIMEOUT || code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_JOINROOM_SVR_ERR) { if (!string.IsNullOrEmpty(m_strLastJoinRoomName)) { m_nJoinRoomErrorTime++; if (m_strLastJoinRoomName.StartsWith("team")) { if (m_nJoinRoomErrorTime >= 3) { TipsManager.Instance.ShowTips("加入队伍聊天室失败重新加入"); } JoinTeamRoom(); } else if (m_strLastJoinRoomName.StartsWith("national")) { if (m_nJoinRoomErrorTime >= 3) { TipsManager.Instance.ShowTips("加入氏族聊天室失败重新加入"); } JoinClanRoom(); } else { TipsManager.Instance.ShowTips("加入房间失败 房间名字未知"); } } else { TipsManager.Instance.ShowTips("加入房间失败 房间名字为空"); } } }