Browse Source

修改bug

DESKTOP-FB72PO8\Administrator 1 ngày trước cách đây
mục cha
commit
2a95cd0996

+ 22 - 1
Assets/Scripts/Core/Log/LogServer.cs

@@ -16,12 +16,13 @@ public class LogServer : Singleton<LogServer>
     public string version;
     private string deviceModel;
     private string operatingSystem;
+    private Dictionary<string, float> _hashDic = new Dictionary<string, float>();
 
     public void Init(string gameName)
     {
         this.gameName = gameName;
         version = Application.version;
-        deviceModel = SystemInfo.deviceName + "  " + SystemInfo.deviceModel+"   "+SystemInfo.deviceUniqueIdentifier;
+        deviceModel = SystemInfo.deviceName + "  " + SystemInfo.deviceModel + "   " + SystemInfo.deviceUniqueIdentifier;
         operatingSystem = SystemInfo.operatingSystem;
     }
 
@@ -71,6 +72,26 @@ public class LogServer : Singleton<LogServer>
 
     private async Task UpdatToServer(LogServeData logServeData)
     {
+        float ct = Time.time;
+        if (_hashDic.Count > 200)
+        {
+            _hashDic.Clear();
+        }
+
+        if (_hashDic.TryGetValue(logServeData.hash, out float t))
+        {
+            if ((ct - t) < 10)
+            {
+                return;
+            }
+
+            _hashDic[logServeData.hash] = ct;
+        }
+        else
+        {
+            _hashDic.Add(logServeData.hash, t);
+        }
+
         string json = LitJson.JsonMapper.ToJson(logServeData);
         byte[] logData = Encoding.UTF8.GetBytes(json);
         using var httpClient = new HttpClient();

+ 1 - 0
Assets/Scripts/GameLogic/Hero/HeroInfo.cs

@@ -105,6 +105,7 @@ namespace GameLogic.Hero
 
             return GetGuaJiExp() + heroData.exp;
         }
+    
 
         public bool IsGuaijiShangXian()
         {