From ab79514573a21fc69f66d48885a4f0221ff92de9 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期四, 18 十月 2018 16:14:02 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
System/Chat/ChatCenter.cs | 36 +++++++++++++++++++++++++++++++++---
1 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/System/Chat/ChatCenter.cs b/System/Chat/ChatCenter.cs
index ebaa716..7e6acb1 100644
--- a/System/Chat/ChatCenter.cs
+++ b/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
--
Gitblit v1.8.0