From 10ca9daa8cbd54658924e3863752808b8251f0e7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 16 十月 2025 16:22:29 +0800
Subject: [PATCH] 125 战斗 无法快速结束战斗的问题修复
---
Main/System/Battle/BattleField/BattleField.cs | 4 ++++
Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs | 2 +-
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs | 2 ++
Main/System/Battle/BattleManager.cs | 19 +++++++++++++------
Main/System/Team/TeamHero.cs | 9 +++++++++
Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0418_tagObjInfoRefresh.cs | 3 ++-
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB420_tagMCTurnFightState.cs | 19 +++++++++++--------
7 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0418_tagObjInfoRefresh.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0418_tagObjInfoRefresh.cs
index 21af3f4..a058a8e 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0418_tagObjInfoRefresh.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0418_tagObjInfoRefresh.cs
@@ -49,6 +49,7 @@
public static void UpdateBattleField(H0418_tagObjInfoRefresh vNetData)
{
BattleField battleField = BattleManager.Instance.GetBattleField(vNetData.packUID);
- battleField.ObjInfoRefresh(vNetData);
+ if (null != battleField)
+ battleField.ObjInfoRefresh(vNetData);
}
}
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB420_tagMCTurnFightState.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB420_tagMCTurnFightState.cs
index 7abe5b1..e6409e9 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB420_tagMCTurnFightState.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB420_tagMCTurnFightState.cs
@@ -10,13 +10,16 @@
HB420_tagMCTurnFightState vNetData = vNetPack as HB420_tagMCTurnFightState;
BattleField battleField = BattleManager.Instance.GetBattleField(vNetPack.packUID);
- // MapID; // 鑷畾涔夊湴鍥綢D锛屽彲鐢ㄤ簬缁戝畾鎴樻枟鍦板浘鍦烘櫙鍔熻兘锛堝涓荤嚎鍏冲崱銆佷富绾縝oss銆佺埇濉斻�佺珵鎶�鍦虹瓑锛�
- // FuncLineID; // MapID瀵瑰簲鐨勬墿灞曞�硷紝濡傚叿浣撴煇涓叧鍗$瓑 绔犺妭*10000+鍏冲崱缂栧彿*100+绗瑇娉紝濡傜涓�绔狅紝绗�10鍏冲崱鐨刡oss鍊� = 11001
- // State; // 0-璧峰鐘舵�佹爣璁帮紱1-鍑嗗瀹屾瘯锛�2-鎴樻枟涓紱3-鎴樻枟缁撴潫锛�4-缁撶畻濂栧姳锛�5-缁撴潫鐘舵�佹爣璁�
- // TurnNum; // 褰撳墠杞
- // Len;
- // Msg; //size = Len
- JsonData extendData = JsonMapper.ToObject(vNetData.Msg);
- battleField.OnTurnFightState(vNetData.TurnNum, vNetData.State, (int)vNetData.FuncLineID, extendData);
+ // MapID; // 鑷畾涔夊湴鍥綢D锛屽彲鐢ㄤ簬缁戝畾鎴樻枟鍦板浘鍦烘櫙鍔熻兘锛堝涓荤嚎鍏冲崱銆佷富绾縝oss銆佺埇濉斻�佺珵鎶�鍦虹瓑锛�
+ // FuncLineID; // MapID瀵瑰簲鐨勬墿灞曞�硷紝濡傚叿浣撴煇涓叧鍗$瓑 绔犺妭*10000+鍏冲崱缂栧彿*100+绗瑇娉紝濡傜涓�绔狅紝绗�10鍏冲崱鐨刡oss鍊� = 11001
+ // State; // 0-璧峰鐘舵�佹爣璁帮紱1-鍑嗗瀹屾瘯锛�2-鎴樻枟涓紱3-鎴樻枟缁撴潫锛�4-缁撶畻濂栧姳锛�5-缁撴潫鐘舵�佹爣璁�
+ // TurnNum; // 褰撳墠杞
+ // Len;
+ // Msg; //size = Len
+ JsonData extendData = JsonMapper.ToObject(vNetData.Msg);
+ if (battleField != null)
+ {
+ battleField.OnTurnFightState(vNetData.TurnNum, vNetData.State, (int)vNetData.FuncLineID, extendData);
+ }
}
}
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs
index 3ef6757..bd43b60 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB430_tagSCTurnFightReport.cs
@@ -18,6 +18,8 @@
// 鎴樻姤缁撴灉
string guid = UIHelper.ServerStringTrim(vNetData.GUID);
+
+ Debug.LogError("guid is " + guid);
//绾﹀畾 B430 鍐呭锛堝皬鍖�1闀垮害WORD + 鍖�1 + 灏忓寘2闀垮害WORD + 鍖�2锛�
try
{
diff --git a/Main/System/Battle/BattleField/BattleField.cs b/Main/System/Battle/BattleField/BattleField.cs
index 0c48336..f041a08 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -35,6 +35,8 @@
protected set;
}
+ public bool rejectNewPackage = false;
+
private bool m_IsPause = false;
public bool IsPause
@@ -134,6 +136,7 @@
SetSpeedRatio(BattleManager.Instance.speedGear[BattleManager.Instance.speedIndex]);
}
SetRootNodePosition();
+ rejectNewPackage = false;
}
public void SetSpeedRatio(float ratio)
@@ -291,6 +294,7 @@
{
//宸茬粡缁撴潫骞剁粨绠�
Debug.Log("鎴樻枟缁撴潫");
+ rejectNewPackage = true;
OnBattleEnd(turnFightStateData);
return;
}
diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index 2d8d217..366c219 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -380,11 +380,18 @@
{
uidList.Add(packUID);
}
+
}
public BattleField GetBattleField(ulong packUID)
{
- return GetBattleField(GetGUID(packUID));
+ string guid = GetGUID(packUID);
+ BattleField battleField = GetBattleField(GetGUID(packUID));
+ if (battleField == null || battleField.rejectNewPackage)
+ {
+ return null;
+ }
+ return battleField;
}
public BattleField GetBattleField(string guid)
@@ -417,6 +424,11 @@
return;
}
+ if (queue.Count <= 0)
+ {
+ return;
+ }
+
var pack = queue.Dequeue();
// Debug.LogError("DistributeNextReportPackage for guid : " + guid + " pack type : " + pack.GetType());
@@ -439,11 +451,6 @@
catch (Exception ex)
{
Debug.LogError("DistributeNextPackage: 鍒嗗彂鍖呭紓甯� " + ex);
- // 鍑洪敊鏃朵富鍔ㄧЩ闄ゅ綋鍓嶅寘锛岄槻姝㈡寰幆
- if (packQueue.Count > 0)
- {
- packQueue.Dequeue();
- }
}
if (queue.Count <= 0)
diff --git a/Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs b/Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs
index be527cd..5ce711f 100644
--- a/Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs
+++ b/Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs
@@ -30,7 +30,7 @@
this.bulletEffect = bulletEffect;
this.target = target;
this.onHit = onHit;
- this.bulletTrans = bulletEffect.transform as RectTransform;
+ this.bulletTrans = bulletEffect.rectTrans;
this.hurts = hurtList;
this.mBulletIndex = bulletIndex;
diff --git a/Main/System/Team/TeamHero.cs b/Main/System/Team/TeamHero.cs
index 5949d96..30065a2 100644
--- a/Main/System/Team/TeamHero.cs
+++ b/Main/System/Team/TeamHero.cs
@@ -62,6 +62,15 @@
throw new System.Exception("hero id and skin id are both invalid, npc id is invalid too (all <= 0)");
}
+ if (fightObj.NPCID > 0)
+ {
+ NPCConfig npcConfig = NPCConfig.Get((int)fightObj.NPCID);
+ if (null != npcConfig)
+ {
+ modelScale = npcConfig.ModelScale;
+ }
+ }
+
level = (int)fightObj.LV;
skinConfig = HeroSkinConfig.Get(SkinID);
--
Gitblit v1.8.0