| | |
| | | m_VoiceChatDict.Clear();
|
| | | autoPlayVoices.Clear();
|
| | | voicePlaying = false;
|
| | | netState = 0;
|
| | | }
|
| | |
|
| | | public void OnSwitchAccount()
|
| | |
| | | }
|
| | | var bytes = Convert.FromBase64String(speech.content);
|
| | | SaveSpeech(_player, tick, bytes);
|
| | | if (autoPlayVoices.Count > 0
|
| | | && autoPlayVoices[0].playerId == _player
|
| | | && autoPlayVoices[0].tick == tick)
|
| | | {
|
| | | AutoPlayVoice();
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | dict = new Dictionary<long, AudioClip>();
|
| | | speechDict.Add(_decodec.playerId, dict);
|
| | | }
|
| | | if (dict.ContainsKey(_decodec.tick))
|
| | | {
|
| | | return;
|
| | | }
|
| | | var clip = AudioClip.Create("Sound", _decodec.samples.Length, 1, VoiceSettings.frequency, false);
|
| | | clip.SetData(_decodec.samples, 0);
|
| | | dict.Add(_decodec.tick, clip);
|
| | | if (_decodec.playerId == cachePlayerId && cacheTick == _decodec.tick)
|
| | | {
|
| | | PlaySpeech(clip, cacheLength);
|
| | | }
|
| | | else if (autoPlayVoices.Count > 0)
|
| | | {
|
| | | AutoPlayVoice();
|
| | | }
|
| | | if (speechDownloadSuccess != null)
|
| | | {
|
| | |
| | | return ChatInfoType.World;
|
| | | }
|
| | |
|
| | | int netState = 0;
|
| | |
|
| | | private void OnNetStatusChanged(NetworkReachability _state)
|
| | | {
|
| | | netState = (int)_state;
|
| | | if (netState != 1 && netState != 4)
|
| | | if ((int)SDKUtility.Instance.NetworkType == 0)
|
| | | {
|
| | | autoPlayVoices.Clear();
|
| | | }
|
| | |
| | |
|
| | | public void CheckAutoPlayVoice(ChatData _chat)
|
| | | {
|
| | | var _netState = netState;
|
| | | var netType = (int)SDKUtility.Instance.NetworkType;
|
| | | #if UNITY_EDITOR
|
| | | _netState = 1;
|
| | | netType = 2;
|
| | | #endif
|
| | | if (!serverInited)
|
| | | {
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | if (!ChatSetting.Instance.GetAutoPlayVoice(_chat.type, _netState))
|
| | | if (!ChatSetting.Instance.GetAutoPlayVoice(_chat.type, netType))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | case ChatBoolType.GradVoice4G:
|
| | | case ChatBoolType.GradVoiceWifi:
|
| | | if (!ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Fairy, 1)
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Fairy, 4))
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Fairy, 2))
|
| | | {
|
| | | RemoveAutoVoice(ChatInfoType.Fairy);
|
| | | }
|
| | |
| | | case ChatBoolType.PrivatChatVoice4G:
|
| | | case ChatBoolType.PrivateChatVoiceWifi:
|
| | | if (!ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Friend, 1)
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Friend, 4))
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Friend, 2))
|
| | | {
|
| | | RemoveAutoVoice(ChatInfoType.Friend);
|
| | | }
|
| | |
| | | case ChatBoolType.TeamVoice4G:
|
| | | case ChatBoolType.TeamVoiceWifi:
|
| | | if (!ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Team, 1)
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Team, 4))
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Team, 2))
|
| | | {
|
| | | RemoveAutoVoice(ChatInfoType.Team);
|
| | | }
|
| | |
| | | case ChatBoolType.WorldVoice4G:
|
| | | case ChatBoolType.WorldVoiceWifi:
|
| | | if (!ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.World, 1)
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.World, 4))
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.World, 2))
|
| | | {
|
| | | RemoveAutoVoice(ChatInfoType.World);
|
| | | }
|
| | |
| | | case ChatBoolType.AreaVoiceWifi:
|
| | | case ChatBoolType.AreaVoice4G:
|
| | | if (!ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Area, 1)
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Area, 4))
|
| | | && !ChatSetting.Instance.GetAutoPlayVoice(ChatInfoType.Area, 2))
|
| | | {
|
| | | RemoveAutoVoice(ChatInfoType.Area);
|
| | | }
|