From 29fd27541c91dc1bf6147c1de5cf5680dfc6cb38 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期五, 24 十月 2025 18:22:05 +0800
Subject: [PATCH] 136 按钮增加触发间隔,发包过于频繁会弹提示

---
 Main/System/BoneField/BoneFieldManager.cs         |   10 ----------
 Main/System/Battle/BattleManager.cs               |   27 +++++++++++++++++++++++++++
 Main/System/Arena/ArenaRecordCell.cs              |    2 +-
 Main/System/MainLevel/MainBossEnterWin.cs         |    6 +-----
 Main/System/Arena/ArenaChallengeCell.cs           |    2 +-
 Main/System/Arena/ArenaManager.cs                 |    9 ---------
 Main/System/BoneField/BoneFieldChallengeButton.cs |    2 +-
 7 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/Main/System/Arena/ArenaChallengeCell.cs b/Main/System/Arena/ArenaChallengeCell.cs
index 159efcf..526e913 100644
--- a/Main/System/Arena/ArenaChallengeCell.cs
+++ b/Main/System/Arena/ArenaChallengeCell.cs
@@ -21,7 +21,7 @@
             if (!UIHelper.CheckMoneyCount(ArenaManager.Instance.ChallengeMoneyType, ArenaManager.Instance.NeedChallengeMoneyCnt, 1))
                 return;
             ArenaManager.Instance.atkPlayerId = arenaMatchInfo.PlayerID;
-            ArenaManager.Instance.SendTurnFight(arenaMatchInfo.PlayerID);
+            BattleManager.Instance.SendTurnFight(3, 0, 1, (uint)arenaMatchInfo.PlayerID);
         });
     }
 
diff --git a/Main/System/Arena/ArenaManager.cs b/Main/System/Arena/ArenaManager.cs
index 2b9df76..688c257 100644
--- a/Main/System/Arena/ArenaManager.cs
+++ b/Main/System/Arena/ArenaManager.cs
@@ -236,15 +236,6 @@
         GameNetSystem.Instance.SendInfo(pack);
     }
 
-    public void SendTurnFight(uint playerID)
-    {
-        CB410_tagCMTurnFight pack = new CB410_tagCMTurnFight();
-        pack.MapID = 3;
-        pack.TagType = 1;
-        pack.TagID = playerID;
-        GameNetSystem.Instance.SendInfo(pack);
-    }
-
     public bool IsTimeInvalid(uint time)
     {
         DateTime dateTime = TimeUtility.GetTime(time);
diff --git a/Main/System/Arena/ArenaRecordCell.cs b/Main/System/Arena/ArenaRecordCell.cs
index 9e4470f..e8ab917 100644
--- a/Main/System/Arena/ArenaRecordCell.cs
+++ b/Main/System/Arena/ArenaRecordCell.cs
@@ -24,7 +24,7 @@
         {
             if (arenaGameRec == null)
                 return;
-            ArenaManager.Instance.SendTurnFight(arenaGameRec.Value3);
+            BattleManager.Instance.SendTurnFight(3, 0, 1, (uint)arenaGameRec.Value3);
             ArenaManager.Instance.atkPlayerId = arenaGameRec.Value3;
         });
     }
diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index af13f2a..fe2abf2 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -586,6 +586,33 @@
         return null;
     }
 
+    //鍙戣繘鍏ユ垬鏂楀寘
+    private float lastTime = 0f;
+    private float turnCoolDown = 0.5f; // 鍐峰嵈鏃堕棿
+    public void SendTurnFight(uint mapID, uint funcLineID = 0, byte tagType = 0, uint tagID = 0, uint[] valueList = null)
+    {
+        // 杩炵画棰戠箒鍙戝寘锛岃Е鍙戞彁绀�
+        float currentTime = Time.time;
+        if (currentTime - lastTime < turnCoolDown)
+        {
+            SysNotifyMgr.Instance.ShowTip("BattleCoolDown");
+            return;
+        }
+        lastTime = currentTime;
+
+        CB410_tagCMTurnFight pack = new CB410_tagCMTurnFight();
+        pack.MapID = mapID;
+        pack.FuncLineID = funcLineID;
+        pack.TagType = tagType;
+        pack.TagID = tagID;
+        if (!valueList.IsNullOrEmpty())
+        {
+            pack.ValueList = valueList;
+            pack.ValueCount = (byte)valueList.Length;
+        }
+        GameNetSystem.Instance.SendInfo(pack);
+    }
+
     // 鑾峰彇褰撳墠姝e湪鏄剧ず鐨勬垬鏂楀満鏅悕绉帮紝濡傛灉娌℃湁鍒欒繑鍥炵┖瀛楃涓�
     public string GetActiveBattleName()
     {
diff --git a/Main/System/BoneField/BoneFieldChallengeButton.cs b/Main/System/BoneField/BoneFieldChallengeButton.cs
index 3c27806..b11d934 100644
--- a/Main/System/BoneField/BoneFieldChallengeButton.cs
+++ b/Main/System/BoneField/BoneFieldChallengeButton.cs
@@ -49,6 +49,6 @@
         if (!DungeonManager.Instance.TryGetFBInfoByMapID(BoneFieldManager.Instance.DataMapID, out var fbInfo))
             return;
         int nowPassLineID = BoneFieldManager.Instance.GetNowPassLineID(fbInfo);
-        BoneFieldManager.Instance.SendTurnFight(BoneFieldManager.Instance.DataMapID, nowPassLineID);
+        BattleManager.Instance.SendTurnFight((uint)BoneFieldManager.Instance.DataMapID, (uint)nowPassLineID);
     }
 }
diff --git a/Main/System/BoneField/BoneFieldManager.cs b/Main/System/BoneField/BoneFieldManager.cs
index e4e4857..3305407 100644
--- a/Main/System/BoneField/BoneFieldManager.cs
+++ b/Main/System/BoneField/BoneFieldManager.cs
@@ -132,14 +132,6 @@
         return true;
     }
 
-    public void SendTurnFight(int mapID, int funcLineID)
-    {
-        CB410_tagCMTurnFight pack = new CB410_tagCMTurnFight();
-        pack.MapID = (uint)mapID;
-        pack.FuncLineID = (uint)funcLineID;
-        GameNetSystem.Instance.SendInfo(pack);
-    }
-
     public void SendBBeginFBWipeOut(int mapID, int lineID)
     {
         CA505_tagCMBeginFBWipeOut pack = new CA505_tagCMBeginFBWipeOut();
@@ -148,8 +140,6 @@
         pack.Cnt = 1;
         GameNetSystem.Instance.SendInfo(pack);
     }
-
-
 
     public void SendBuyEnterCount(int FBID)
     {
diff --git a/Main/System/MainLevel/MainBossEnterWin.cs b/Main/System/MainLevel/MainBossEnterWin.cs
index 212b555..7bde641 100644
--- a/Main/System/MainLevel/MainBossEnterWin.cs
+++ b/Main/System/MainLevel/MainBossEnterWin.cs
@@ -136,11 +136,7 @@
     {
         if (MainLevelManager.Instance.CanChallengeBoss())
         {
-            var pack = new CB410_tagCMTurnFight();
-            pack.MapID = 2;
-            // pack.FuncLineID = (uint)PlayerDatas.Instance.baseData.ExAttr1 + 1;
-            GameNetSystem.Instance.SendInfo(pack);
-
+            BattleManager.Instance.SendTurnFight(2);
             AutoFightModel.Instance.isPause = true;
         }
         CloseWindow();

--
Gitblit v1.8.0