From 6faba902086330e9c2c49948b10e5aeecb893bcd Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 26 九月 2025 17:02:40 +0800
Subject: [PATCH] 125 战斗 取消行动包的设定 修复行动莫名结束的bug
---
Main/System/Battle/RecordPlayer/RecordPlayer.cs | 4
Main/System/Battle/UIComp/BasicHeroInfoContainer.cs | 5
Main/System/Battle/BattleManager.cs | 149 ++++++-----------------------
Main/System/Battle/BattleUtility.cs | 27 +---
Main/System/Battle/Skill/SkillBase.cs | 62 +++++++++++-
Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs | 6
Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs | 21 ++++
7 files changed, 126 insertions(+), 148 deletions(-)
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
index ce2e53f..7d4214d 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -31,6 +31,7 @@
}
endTag = _endTag;
toIndex = _toIndex;
+ PrintAllPack();
}
@@ -43,6 +44,26 @@
}
fromIndex = _fromIndex;
startTag = tag;
+
+
+ }
+
+ public void PrintAllPack()
+ {
+ string temp = "CustomHB426CombinePack startTag: " + (startTag != null ? startTag.Tag : "null") + " fromIndex: " + fromIndex + " toIndex: " + toIndex + "\n";
+ for (int i = 0; i < packList.Count; i++)
+ {
+ var pack = packList[i];
+ if (pack is CustomHB426CombinePack b426Pack)
+ {
+ temp += " pack type is " + pack.GetType().Name + " tag is " + (b426Pack.startTag != null ? b426Pack.startTag.Tag : "null") + "\n";
+ }
+ else
+ {
+ temp += " pack type is " + pack.GetType().Name + "\n";
+ }
+ }
+ BattleDebug.LogError(temp);
}
public void AddPack(GameNetPackBasic pack)
diff --git a/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
index 0e6a4a0..288a850 100644
--- a/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
@@ -42,10 +42,10 @@
if (isLastOne)
{
- UniTaskExtension.DelayTime((GameObject)null, 0.3f / battleField.speedRatio, () =>
- {
+ // UniTaskExtension.DelayTime((GameObject)null, 0.3f / battleField.speedRatio, () =>
+ // {
isFinish = true;
- });
+ // });
}
});
}
diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index 7c22487..966d0e7 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -126,6 +126,30 @@
List<GameNetPackBasic> packQueueSnapshot = new List<GameNetPackBasic>(packQueue);
List<GameNetPackBasic> newPackList = ParseBattlePackList(string.Empty, packQueueSnapshot);
+
+ Action printNewPack = () =>
+ {
+ string temp = "After AnalysisPackQueueAndDistribute newPackList count: " + newPackList.Count + "\n";
+ foreach (var pack in newPackList)
+ {
+ if (pack is CustomHB426CombinePack b426Pack)
+ {
+ temp += " pack type is " + pack.GetType().Name + " tag is " + (b426Pack.startTag != null ? b426Pack.startTag.Tag : "null") + "\n";
+ }
+ else if (pack is CustomB421ActionPack b421Pack)
+ {
+ temp += " pack type is " + pack.GetType().Name + " guid is " + b421Pack.guid + "\n";
+ }
+ else
+ {
+ temp += " pack type is " + pack.GetType().Name + "\n";
+ }
+ }
+ Debug.LogWarning(temp);
+ };
+
+ printNewPack();
+
// HashSet<int> skipIndexes = new HashSet<int>();
// // 杩欓噷宸茬粡鏄寜鐓equeue鐨勯『搴忎簡
@@ -210,127 +234,15 @@
public static List<GameNetPackBasic> ParseBattlePackList(string guid, List<GameNetPackBasic> packQueueSnapshot)
{
- bool wrong = false;
-
- List<GameNetPackBasic> newPackList = new List<GameNetPackBasic>();
-
- HB421_tagMCTurnFightObjAction b421Pack = null;
-
- for (int i = 0; i < packQueueSnapshot.Count; i++)
+ var list = CustomHB426CombinePack.CombineToSkillPackFromList(guid, packQueueSnapshot);
+ string str = "ParseBattlePackList \n";
+ for (int i = 0; i < list.Count; i++)
{
- GameNetPackBasic pack = packQueueSnapshot[i];
- if (null == b421Pack)
- {
- if (pack is HB421_tagMCTurnFightObjAction _b421)
- {
- b421Pack = _b421;
- }
- else
- {
- newPackList.Add(pack);
- }
- continue;
- }
- else
- {
- List<GameNetPackBasic> b421List = new List<GameNetPackBasic>();
-
- bool find = false;
-
- for (int k = i; k < packQueueSnapshot.Count; k++/*, Debug.LogError(k + " : is plusing")*/)
- {
- GameNetPackBasic maybeB426Pack = packQueueSnapshot[k];
-
- if (maybeB426Pack is HB426_tagSCTurnFightTag b426Pack)
- {
- // Debug.LogError(k + " : find b426 " + maybeB426Pack.packUID + " sign " + b426Pack.Sign + " tag " + b426Pack.Tag);
- if (b426Pack.Sign == 0)
- {
- find = true;
- List<GameNetPackBasic> b426List = new List<GameNetPackBasic>();
- b426List.Add(b426Pack);
- for (int j = k + 1; j < packQueueSnapshot.Count; j++)
- {
- GameNetPackBasic maybeB426EndPack = packQueueSnapshot[j];
- if (maybeB426EndPack is HB426_tagSCTurnFightTag b426EndPack)
- {
- // Debug.LogError(j + " : find b426 end pack : " + b426EndPack.packUID + " sign " + b426EndPack.Sign + " tag " + b426EndPack.Tag);
-
- if (b426EndPack.Tag == b426Pack.Tag)
- {
- if (b426EndPack.Sign == 1)
- {
- b426List.Add(maybeB426EndPack);
- k = j;
- i = k;
- break;
- }
- else
- {
- Debug.LogError("閿欒鐨凷ign == 1");
- continue;
- }
- }
- else
- {
- // 鏂扮殑涓�瀵�
- }
- }
- else
- {
- b426List.Add(maybeB426EndPack);
- k = j;
- i = k;
- }
- }
- // 杩欓噷闈㈢殑b421杩樻病澶勭悊
- List<GameNetPackBasic> combinedList = CustomHB426CombinePack.CombineToSkillPackFromList(guid, b426List);
- b421List.AddRange(combinedList);
- }
- else
- {
- wrong = true;
- Debug.LogError("閿欒鐨刡426 鍒嗘瀽鏈夐棶棰� " + b426Pack.packUID);
- }
- }
- else
- {
- if (!find)
- {
- newPackList.Add(maybeB426Pack);
- i = k;
- }
- else
- {
- if (maybeB426Pack is HB421_tagMCTurnFightObjAction _b421)
- {
- i = k - 1;
- break;
- }
-
- b421List.Add(maybeB426Pack);
- i = k;
- }
- }
- }
- CustomB421ActionPack actionPack = CustomB421ActionPack.CreateB421ActionPack(guid, b421List);
- newPackList.Add(actionPack);
- b421Pack = null;
- }
+ str += " " + list[i].GetType().Name + "\n";
}
+ BattleDebug.LogError(str);
+ return list;
- if (wrong)
- {
- string output = string.Empty;
- for (int f = 0; f < packQueueSnapshot.Count; f++)
- {
- output += (packQueueSnapshot[f].packUID + "&" + packQueueSnapshot[f].GetType().ToString() + "|");
- }
-
- Debug.LogError(output);
- }
-
- return newPackList;
}
// 涓撳睘浜庝富绾挎垬鏂楃殑娲惧彂
@@ -596,6 +508,7 @@
// 4-缁х画鎴樻枟 - 鐜╁涓荤嚎鎴樻枟涓紙鍖呭惈涓荤嚎灏忔��佷富绾縝oss锛夛紝鍓嶇琛ㄧ幇瀹屽悗绔悓姝ョ殑鎴樻枟鐗囨鍚庯紝鍙啀鍥炲璇ュ�硷紝鍚庣浼氭牴鎹垬鏂楅�昏緫鍙婃祦绋嬭嚜鍔ㄥ洖澶嶄笅涓�娈电殑鎴樻枟鐗囨灏佸寘锛屼竴鐩村惊鐜�
public void MainFightRequest(byte reqType, uint reqValue = 0)
{
+ // Debug.LogError("MainFightRequest reqType " + reqType + " reqValue " + reqValue);
CB413_tagCSMainFightReq req = new CB413_tagCSMainFightReq();
req.ReqType = reqType;
req.ReqValue = reqValue;
diff --git a/Main/System/Battle/BattleUtility.cs b/Main/System/Battle/BattleUtility.cs
index 2fa36ae..3d39c4e 100644
--- a/Main/System/Battle/BattleUtility.cs
+++ b/Main/System/Battle/BattleUtility.cs
@@ -306,47 +306,36 @@
{
var pack = packList[i];
// 瀵绘壘姝讳骸鍖� 鎵惧埌姝讳骸鍖呬箣鍚庤鎵炬帀钀藉寘 涓嶈兘瓒呰繃鎶�鑳藉寘
- if (pack is HB422_tagMCTurnFightObjDead)
+ if (pack is HB422_tagMCTurnFightObjDead deadPack)
{
- var deadPack = pack as HB422_tagMCTurnFightObjDead;
deadPacks.Add(deadPack);
}
else if (pack is CustomHB426CombinePack)
{
- // 鎵炬浜″寘涓嶈瓒婅繃鎶�鑳藉寘
- var combinePack = pack as CustomHB426CombinePack;
- if (combinePack.startTag.Tag.StartsWith("Skill_"))
- {
- break;
- }
+ break;
}
}
+ // Debug.LogError("find dead pack " + deadPacks.Count);
return deadPacks;
}
public static List<HB423_tagMCTurnFightObjReborn> FindRebornPack(List<GameNetPackBasic> packList)
{
- List<HB423_tagMCTurnFightObjReborn> rebornPack = new List<HB423_tagMCTurnFightObjReborn>();
+ List<HB423_tagMCTurnFightObjReborn> rebornPackList = new List<HB423_tagMCTurnFightObjReborn>();
for (int i = 0; i < packList.Count; i++)
{
var pack = packList[i];
// 瀵绘壘姝讳骸鍖� 鎵惧埌姝讳骸鍖呬箣鍚庤鎵炬帀钀藉寘 涓嶈兘瓒呰繃鎶�鑳藉寘
- if (pack is HB423_tagMCTurnFightObjReborn)
+ if (pack is HB423_tagMCTurnFightObjReborn rebornPack)
{
- var deadPack = pack as HB423_tagMCTurnFightObjReborn;
- rebornPack.Add(deadPack);
+ rebornPackList.Add(rebornPack);
}
else if (pack is CustomHB426CombinePack)
{
- // 鎵炬浜″寘涓嶈瓒婅繃鎶�鑳藉寘
- var combinePack = pack as CustomHB426CombinePack;
- if (combinePack.startTag.Tag.StartsWith("Skill_"))
- {
- break;
- }
+ break;
}
}
- return rebornPack;
+ return rebornPackList;
}
}
\ No newline at end of file
diff --git a/Main/System/Battle/RecordPlayer/RecordPlayer.cs b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
index caec5b3..d0c1c33 100644
--- a/Main/System/Battle/RecordPlayer/RecordPlayer.cs
+++ b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
@@ -25,7 +25,9 @@
public bool IsPlaying()
{
- return currentRecordAction != null || recordActionQueue.Count > 0 || immediatelyActionList.Count > 0;
+ bool isPlaying = currentRecordAction != null || recordActionQueue.Count > 0 || immediatelyActionList.Count > 0;
+ //BattleDebug.LogError("IsPlaying " + isPlaying + " currentRecordAction " + (currentRecordAction != null) + " recordActionQueue.Count " + recordActionQueue.Count + " immediatelyActionList.Count " + immediatelyActionList.Count);
+ return isPlaying;
}
public void PlayRecord(RecordAction recordAction)
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index 49f7c3c..232a5ea 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -36,6 +36,8 @@
public int fromSkillId;
+ public bool isPlay = false;
+
public SkillBase(BattleObject _caster, SkillConfig _skillCfg, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> _packList, BattleField _battleField = null)
{
caster = _caster;
@@ -48,13 +50,12 @@
battleField = _battleField;
packList = _packList;
-
+
}
public virtual void Run()
{
-
if (null != skillEffect)
{
if (skillEffect.IsFinished())
@@ -66,6 +67,7 @@
{
skillEffect.Run();
}
+ return;
}
if (otherSkillAction != null)
@@ -79,6 +81,7 @@
{
otherSkillAction.Run();
}
+ return;
}
}
@@ -289,6 +292,7 @@
// OnMiddleFrameEnd 涓憞缁撴潫
// OnFinalFrameStart 鍚庢憞寮�濮�
// OnFinalFrameEnd 鍚庢憞缁撴潫
+
return caster.motionBase.PlaySkillAnimation(skillConfig, this, onComplete);
}
@@ -302,6 +306,8 @@
);
skillEffect.Play(OnHitTargets);
+ isPlay = true;
+
}
// 鎶�鑳藉墠鎽囧抚缁撴潫
@@ -604,11 +610,22 @@
}
public virtual bool IsFinished()
{
+ if (!isPlay)
+ {
+ return false;
+ }
+
if (skillEffect != null)
{
if (!skillEffect.IsFinished())
{
return false;
+ }
+ else
+ {
+ skillEffect = null;
+ OnSkillFinished();
+ return false;
}
}
@@ -618,7 +635,14 @@
{
return false;
}
+ else
+ {
+ otherSkillAction = null;
+ OnSkillFinished();
+ return false;
+ }
}
+
if (isFinished && moveFinished)
{
@@ -632,7 +656,13 @@
}
battleField.battleRootNode.skillMaskNode.SetActive(false);
- return true;
+ if (packList.Count > 0)
+ {
+ OnSkillFinished();
+ return false;
+ }
+
+ return packList.Count <= 0;
}
else
{
@@ -645,6 +675,7 @@
skillEffect?.ForceFinished();
isFinished = true;
moveFinished = true;
+ isPlay = true;
while (packList.Count > 0)
{
@@ -657,7 +688,7 @@
{
BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag);
otherSkillAction = combinePack.CreateSkillAction();
-
+ otherSkillAction.fromSkillId = skillConfig.SkillID;
// 寮哄埗缁撴潫鍏朵粬鎶�鑳�
otherSkillAction.ForceFinish();
return;
@@ -666,7 +697,6 @@
else if (pack is CustomB421ActionPack actionPack)
{
actionPack.Distribute();
- return;
}
PackageRegedit.Distribute(pack);
}
@@ -679,6 +709,25 @@
if (!skillEffect.IsFinished())
{
return;
+ }
+ else
+ {
+ skillEffect = null;
+ OnSkillFinished();
+ }
+
+ }
+
+ if (otherSkillAction != null)
+ {
+ if (!otherSkillAction.IsFinished())
+ {
+ return;
+ }
+ else
+ {
+ otherSkillAction = null;
+ OnSkillFinished();
}
}
@@ -701,8 +750,9 @@
else if (pack is CustomB421ActionPack actionPack)
{
actionPack.Distribute();
- return;
}
+
+ // Debug.LogError("Distribute pack " + pack.GetType().ToString());
PackageRegedit.Distribute(pack);
}
diff --git a/Main/System/Battle/UIComp/BasicHeroInfoContainer.cs b/Main/System/Battle/UIComp/BasicHeroInfoContainer.cs
index 8f7c1eb..c51903c 100644
--- a/Main/System/Battle/UIComp/BasicHeroInfoContainer.cs
+++ b/Main/System/Battle/UIComp/BasicHeroInfoContainer.cs
@@ -7,9 +7,12 @@
public Image countryIcon;
+ public Text txtLv;
+
public void SetHeroInfo(TeamHero teamHero)
{
- txtLvName.text = string.Format("Lv.{0} {1}", teamHero.level, teamHero.name);
+ txtLvName.text = teamHero.name; //string.Format("{0}", teamHero.level, teamHero.name);
countryIcon.SetSprite(HeroUIManager.Instance.GetCountryIconName((int)teamHero.Country));
+ txtLv.text = string.Format("[{0}]", teamHero.level);
}
}
\ No newline at end of file
--
Gitblit v1.8.0