少年修仙传客户端代码仓库
client_Wu Xijin
2018-10-18 ab79514573a21fc69f66d48885a4f0221ff92de9
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
3个文件已修改
39 ■■■■ 已修改文件
System/Chat/ChatCenter.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Effect/TimeMgr.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Utility/TimeUtility.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Chat/ChatCenter.cs
@@ -332,9 +332,13 @@
                           var _player = int.Parse(speech.playerID);
                           if (string.IsNullOrEmpty(speech.content))
                           {
                               if ((TimeUtility.ServerNow - TimeUtility.ClientOriginalTime.AddTicks(_tick)).TotalMinutes < 2)//可能是语音未上传成功
                               var seconds = (TimeUtility.ServerNow - TimeUtility.ClientOriginalTime.AddTicks(_tick)).TotalSeconds;
                               if (seconds < 10 && seconds >= 0)//可能是语音未上传成功
                               {
                                   AutoPlayVoice();
                                   if (!CheckAutoRequestInDelay(tick, _player))
                                   {
                                       AutoPlayVoice();
                                   }
                               }
                               else
                               {
@@ -361,6 +365,27 @@
                       }
                   }
               });
        }
        private bool CheckAutoRequestInDelay(long tick, int playerId)
        {
            var autoPlayVoice = autoPlayVoices.Find((x) =>
            {
                return x.tick == tick && x.playerId == playerId;
            });
            var seconds = 0f;
            if (!autoPlayVoice.Equals(default(VoiceInfo)))
            {
                seconds = (float)(TimeUtility.ServerNow - autoPlayVoice.lastRequestTime).TotalSeconds;
            }
            if (seconds < 2f && seconds > 0)
            {
                TimeMgr.Instance.Register(TimeMgr.SyntonyType.AutoPlayVoice, 2 - seconds, () =>
                  {
                      AutoPlayVoice();
                  });
            }
            return seconds < 2f && seconds > 0;
        }
        private bool CheckRequestTimeLimit(int _playerId, long _tick)
@@ -415,7 +440,10 @@
            dict.Add(_decodec.tick, clip);
            if (_decodec.playerId == cachePlayerId && cacheTick == _decodec.tick)
            {
                cachePlayerId = 0;
                cacheTick = 0;
                PlaySpeech(clip, cacheLength);
                RemoveAutoVoice(_decodec.playerId, _decodec.tick);
            }
            else if (autoPlayVoices.Count > 0)
            {
@@ -621,6 +649,7 @@
                }
                else
                {
                    _speech.lastRequestTime = TimeUtility.ServerNow;
                    DownloadSpeech(_speech.playerId, _speech.tick);
                }
            }
@@ -689,12 +718,13 @@
            });
        }
        public struct VoiceInfo
        public class VoiceInfo
        {
            public int playerId;
            public long tick;
            public float length;
            public ChatInfoType type;
            public DateTime lastRequestTime;
        }
        #endregion
UI/Effect/TimeMgr.cs
@@ -181,5 +181,6 @@
        GetFairyInfo,
        Audio,
        OSRedEnvelope,
        AutoPlayVoice,
    }
}
Utility/TimeUtility.cs
@@ -67,7 +67,7 @@
    /// 服务器起始时间
    /// </summary>
    public static readonly DateTime OriginalTime = new DateTime(1970, 1, 1, 8, 0, 0);
    public static readonly DateTime ClientOriginalTime = new DateTime(1, 1, 1, 12, 0, 0);
    public static readonly DateTime ClientOriginalTime = new DateTime(1, 1, 1, 0, 0, 0);
    /// <summary>
    /// 服务器时间相比起始时间的秒数(主要方便比较)
    /// </summary>