From dc1bcb3215baf92816136f2c72b49b482268700e Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期日, 04 一月 2026 14:58:09 +0800
Subject: [PATCH] 0312 同时掉落几件且是同一个部位好装备,不再帮玩家分解,让玩家继续手动操作
---
Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs | 269 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 254 insertions(+), 15 deletions(-)
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
index 46c9bd6..bcd2b93 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -1,5 +1,5 @@
-
using System.Collections.Generic;
+using System.Linq;
using UnityEngine;
public class CustomHB426CombinePack : GameNetPackBasic
@@ -31,6 +31,7 @@
}
endTag = _endTag;
toIndex = _toIndex;
+ PrintAllPack();
}
@@ -43,6 +44,27 @@
}
fromIndex = _fromIndex;
startTag = tag;
+
+
+ }
+
+ public void PrintAllPack()
+ {
+ string temp = "CustomHB426CombinePack startTag: " + (startTag != null ? startTag.Tag : "null") +
+ " fromIndex: " + fromIndex + " toIndex: " + toIndex + " packList.Count: " + packList.Count + "\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)
@@ -78,9 +100,12 @@
Dictionary<int, GameNetPackBasic> indexDict = new Dictionary<int, GameNetPackBasic>();
+ Dictionary<uint, HB427_tagSCUseSkill> skillDict = new Dictionary<uint, HB427_tagSCUseSkill>();
+
for (int i = 0; i < b421SeriesPackList.Count; i++)
{
var pack = b421SeriesPackList[i];
+
if (pack is HB426_tagSCTurnFightTag)
{
var tag = pack as HB426_tagSCTurnFightTag;
@@ -112,9 +137,48 @@
}
else
{
- indexDict.Add(i, pack);
+ if (pack is HB427_tagSCUseSkill skillPack)
+ {
+ // 澶勭悊鎶�鑳戒箣闂寸殑閾炬帴鍏崇郴
+ if (skillPack.RelatedSkillID > 0)
+ {
+ // 濡傛灉鏄 HB426_tagSCTurnFightTag 鍖呰9鐨勭涓�涓妧鑳藉寘 骞朵笖鍓嶉潰娌℃湁CustomHB426CombinePack
+ // 鍒欓渶瑕佹妸CustomHB426CombinePack鍔犲叆skillPack鐨剆ubSkillCombinePackList閲�
+ // 鍚屾椂 闇�瑕佹妸indexDict閲屽垹鎺夊搴旂殑subSkillCombinePackList
+ // subSkillList鍒犳帀瀵瑰簲skillPack锛屼絾鏄痵killPack鐨刾arentSkill涓嶅彉
+
+ skillDict.TryGetValue(skillPack.RelatedSkillID, out var parentSkill);
+ if (parentSkill != null && skillPack.BattleType == 4)//4=瀛愭妧鑳�
+ {
+ parentSkill.subSkillList.Add(skillPack);
+ skillPack.parentSkill = parentSkill;
+ }
+ indexDict.Add(i, pack);
+ }
+ else
+ {
+ indexDict.Add(i, pack);
+ }
+
+ if (skillDict.ContainsKey(skillPack.SkillID))
+ {
+ skillDict[skillPack.SkillID] = skillPack;
+ }
+ else
+ {
+ skillDict.Add(skillPack.SkillID, skillPack);
+ }
+ }
+ else
+ {
+ indexDict.Add(i, pack);
+ }
}
}
+
+ // 濡傛灉鏄 HB426_tagSCTurnFightTag 鍖呰9鐨勭涓�涓妧鑳藉寘 骞朵笖鍓嶉潰娌℃湁CustomHB426CombinePack
+ // 缈昏瘧涓�涓嬪氨鏄� 濡傛灉CombinePack閲岀殑涓讳綋Skill鍖� skillPack.RelatedSkillID > 0
+
// 宓屽鍖呭唴鐨勫寘鍚堝苟
@@ -126,11 +190,75 @@
{
indexDict.Remove(i);
combinePack.AddPack(pack);
- if (pack is CustomHB426CombinePack)
+ if (pack is CustomHB426CombinePack cbPack)
{
// 濡傛灉鏄祵濂楃殑鍖� 鍔犲叆涔嬪悗 璋冩暣i
- i = (pack as CustomHB426CombinePack).toIndex;
+ i = cbPack.toIndex;
}
+ }
+ }
+ }
+
+
+ for (int i = 0; i < b421SeriesPackList.Count; i++)
+ {
+ if (indexDict.TryGetValue(i, out var pack))
+ {
+ if (pack is CustomHB426CombinePack cbPack)
+ {
+ HB427_tagSCUseSkill skillPack = cbPack.GetMainHB427SkillPack();
+
+ if (null == skillPack)
+ {
+ continue;
+ }
+
+ // 濡傛灉鏄瓙鎶�鑳�
+ if (skillPack.isSubSkill)
+ {
+ // 璁╁埆浜烘潵澶勭悊
+ continue;
+ }
+ else
+ {
+ // 澶勭悊瀛愭妧鑳�
+ if (skillPack.subSkillList.Count > 0)
+ {
+ var parentSkill = skillPack;
+ List<HB427_tagSCUseSkill> toRemoveSubSkills = new List<HB427_tagSCUseSkill>();
+ foreach (var subSkill in parentSkill.subSkillList)
+ {
+ CustomHB426CombinePack innerCBPack = null;
+ if (cbPack.IsInnerCBPackContainsSkill(subSkill, ref innerCBPack))
+ {
+ if (cbPack.GetMainHB427SkillPack() == subSkill)
+ {
+ parentSkill.subSkillList.Remove(subSkill);
+ Debug.LogError("瀛愭妧鑳戒笉鑳芥槸涓绘妧鑳�: " + subSkill.SkillID);
+ continue;
+ }
+ subSkill.parentCombinePack = innerCBPack;
+ cbPack.packList.Remove(innerCBPack);
+ toRemoveSubSkills.Add(subSkill);
+ parentSkill.subSkillCombinePackList.Add(innerCBPack);
+ indexDict.Remove(innerCBPack.fromIndex);
+ }
+ }
+ foreach (var subSkill in toRemoveSubSkills)
+ {
+ parentSkill.subSkillList.Remove(subSkill);
+ }
+ }
+ else
+ {
+ // 涓绘妧鑳芥病鏈夊瓙鎶�鑳� 鐩存帴璺宠繃
+ continue;
+ }
+ }
+ }
+ else if (pack is HB427_tagSCUseSkill skillPack)
+ {
+ // Debug.LogError("钀藉崟鐨勬妧鑳�");
}
}
}
@@ -144,23 +272,50 @@
if (indexDict.TryGetValue(i, out var pack))
{
newPackList.Add(pack);
- if (pack is CustomHB426CombinePack)
- {
- var cbpack = pack as CustomHB426CombinePack;
- // temp += "pack type is " + pack.GetType().Name + " tag is " + cbpack.startTag.Tag + "\n";
- }
- else
- {
- // temp += "pack type is " + pack.GetType().Name + "\n";
- }
}
}
+
+ // newPackList = BattleManager.ParseBattlePackList(_guid, newPackList);
// Debug.LogError(temp);
return newPackList;
}
+ public HB427_tagSCUseSkill GetMainHB427SkillPack()
+ {
+ for (int i = 0; i < packList.Count; i++)
+ {
+ var pack = packList[i];
+ if (pack is HB427_tagSCUseSkill skillPack)
+ {
+ return skillPack;
+ }
+ else if (pack is CustomHB426CombinePack)
+ {
+ return null;
+ }
+ }
+
+ return null;
+ }
+
+ public bool IsInnerCBPackContainsSkill(HB427_tagSCUseSkill skill, ref CustomHB426CombinePack innerCBPack)
+ {
+ for (int i = 0; i < packList.Count; i++)
+ {
+ var pack = packList[i];
+ if (pack is CustomHB426CombinePack cbPack)
+ {
+ if (cbPack.packList.Contains(skill))
+ {
+ innerCBPack = cbPack;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
public void Distribute()
{
BattleField battleField = BattleManager.Instance.GetBattleField(guid);
@@ -176,6 +331,57 @@
{
battleField.PlayRecord(skillAction);
}
+ else
+ {
+ battleField.DistributeNextPackage();
+ }
+
+ }
+
+ public static SkillRecordAction CreateSkillAction(string guid, List<GameNetPackBasic> _packList)
+ {
+ BattleField battleField = BattleManager.Instance.GetBattleField(guid);
+
+ if (null == battleField)
+ {
+ Debug.LogError("BattleField not found for guid: " + guid);
+ return null;
+ }
+
+ while (_packList.Count > 0)
+ {
+ var pack = _packList[0];
+ _packList.RemoveAt(0);
+
+ if (pack is HB427_tagSCUseSkill)
+ {
+ _packList.Insert(0, pack);
+ break;
+ }
+ else if (pack is CustomHB426CombinePack)
+ {
+ Debug.LogError("鏃犳硶鎵惧埌Skill鍖咃紝鍏堝彂鐜颁簡宓屽鍖�");
+ return null;
+ }
+ else
+ {
+ pack.commonMark = true;
+ PackageRegedit.Distribute(pack);
+ }
+ }
+
+ HB427_tagSCUseSkill skill = _packList[0] as HB427_tagSCUseSkill;
+ _packList.RemoveAt(0);
+ if (null == skill)
+ {
+ Debug.LogError("No HB427_tagSCUseSkill found in packList.");
+ return null;
+ }
+
+ BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
+
+ SkillRecordAction skillAction = new SkillRecordAction(battleField, _caster, skill, _packList);
+ return skillAction;
}
@@ -189,12 +395,45 @@
return null;
}
+ // 鏈嶅姟鍣ㄤ慨鏀逛簡 鐜板湪绗竴涓笉涓�瀹氭槸B427 涔熸湁鍙兘鏄疊428 鍏堟斁Buff
+ while (packList.Count > 0)
+ {
+ var pack = packList[0];
+ packList.RemoveAt(0);
+
+ if (pack is HB427_tagSCUseSkill)
+ {
+ packList.Insert(0, pack);
+ break;
+ }
+ else if (pack is CustomHB426CombinePack)
+ {
+ Debug.LogError("鏃犳硶鎵惧埌Skill鍖咃紝鍏堝彂鐜颁簡宓屽鍖�");
+ return null;
+ }
+ else
+ {
+ pack.commonMark = true;
+ PackageRegedit.Distribute(pack);
+ }
+ }
+
if (startTag.Tag.StartsWith("Skill_"))
{
+ if (packList.Count <= 0)
+ {
+ Debug.LogError("No HB427_tagSCUseSkill found in packList." + startTag.Tag);
+ return null;
+ }
HB427_tagSCUseSkill skill = packList[0] as HB427_tagSCUseSkill;
- packList.Remove(skill);
- BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
+ packList.RemoveAt(0);
+ if (null == skill)
+ {
+ Debug.LogError("No HB427_tagSCUseSkill found in packList.");
+ return null;
+ }
+ BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
// BattleDebug.LogError("_caster == null : " + (_caster == null) + " skill.ObjID : " + skill.ObjID);
SkillRecordAction skillAction = new SkillRecordAction(battleField, _caster, skill, packList);
--
Gitblit v1.8.0