少年修仙传客户端代码仓库
client_linchunjie
2018-09-12 bbd61c2b8046be61819be325a3bc892c683e4eda
System/Chat/ChatCenter.cs
@@ -148,7 +148,6 @@
            m_VoiceChatDict.Clear();
            autoPlayVoices.Clear();
            voicePlaying = false;
            netState = 0;
        }
        public void OnSwitchAccount()
@@ -346,12 +345,6 @@
                           }
                           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)
                       {
@@ -404,12 +397,20 @@
                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)
            {
@@ -520,12 +521,9 @@
            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();
            }
@@ -536,9 +534,9 @@
        public void CheckAutoPlayVoice(ChatData _chat)
        {
            var _netState = netState;
            var netType = (int)SDKUtility.Instance.NetworkType;
#if UNITY_EDITOR
            _netState = 1;
            netType = 2;
#endif
            if (!serverInited)
            {
@@ -557,7 +555,7 @@
            {
                return;
            }
            if (!ChatSetting.Instance.GetAutoPlayVoice(_chat.type, _netState))
            if (!ChatSetting.Instance.GetAutoPlayVoice(_chat.type, netType))
            {
                return;
            }
@@ -626,7 +624,7 @@
                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);
                    }
@@ -634,7 +632,7 @@
                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);
                    }
@@ -642,7 +640,7 @@
                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);
                    }
@@ -650,7 +648,7 @@
                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);
                    }
@@ -658,7 +656,7 @@
                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);
                    }