| | |
| | | using System; |
| | | using System.Text; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | // B4 30 查看战报结果 #tagSCTurnFightReportRet |
| | | |
| | | |
| | |
| | | } |
| | | #endif |
| | | |
| | | #if UNITY_EDITOR |
| | | DebugingBuffStatus(vPackList); |
| | | #endif |
| | | |
| | | for (int i = 0; i < vPackList.Count; i++) |
| | | { |
| | | BattleManager.Instance.PushPackage(guid, vPackList[i]); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | #if UNITY_EDITOR |
| | | |
| | | private void DebugingBuffStatus(List<GameNetPackBasic> vPackList) |
| | | { |
| | | if (!Launch.Instance.isOpenSkillLogFile) |
| | | return; |
| | | |
| | | HB424_tagSCTurnFightInit initPack = vPackList.OfType<HB424_tagSCTurnFightInit>().FirstOrDefault(); |
| | | |
| | | if (initPack == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | Dictionary<long, string> uidNameDict = new Dictionary<long, string>(); |
| | | |
| | | foreach (var fightFictionList in initPack.FactionList) |
| | | { |
| | | foreach (var fightLineup in fightFictionList.LineupList) |
| | | { |
| | | foreach (var fightObj in fightLineup.ObjList) |
| | | { |
| | | HeroConfig heroConfig = HeroConfig.Get((int)fightObj.HeroID); |
| | | |
| | | if (heroConfig != null) |
| | | { |
| | | uidNameDict[fightObj.ObjID] = heroConfig.Name; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<HB428_tagSCBuffRefresh> buffRefreshList = vPackList.OfType<HB428_tagSCBuffRefresh>().ToList(); |
| | | List<HB429_tagSCBuffDel> buffDelList = vPackList.OfType<HB429_tagSCBuffDel>().ToList(); |
| | | |
| | | List<GameNetPackBasic> buffPacks = new List<GameNetPackBasic>(); |
| | | buffPacks.AddRange(buffRefreshList); |
| | | buffPacks.AddRange(buffDelList); |
| | | |
| | | // packUID从小到大排序 |
| | | buffPacks.Sort((a, b) => a.packUID.CompareTo(b.packUID)); |
| | | |
| | | Dictionary<string, List<GameNetPackBasic>> nameAndSortedBuffPacks = new Dictionary<string, List<GameNetPackBasic>>(); |
| | | |
| | | string debugInfo = "Buff状态变更日志:\n"; |
| | | |
| | | foreach (var pack in buffPacks) |
| | | { |
| | | if (pack is HB428_tagSCBuffRefresh refreshPack) |
| | | { |
| | | nameAndSortedBuffPacks.TryGetValue(uidNameDict.ContainsKey(refreshPack.ObjID) ? uidNameDict[refreshPack.ObjID] : "Unknown", out var packList); |
| | | |
| | | string heroName = uidNameDict.ContainsKey(refreshPack.ObjID) ? uidNameDict[refreshPack.ObjID] : "Unknown"; |
| | | |
| | | if (nameAndSortedBuffPacks.TryGetValue(heroName, out var list)) |
| | | { |
| | | list.Add(pack); |
| | | } |
| | | else |
| | | { |
| | | list = new List<GameNetPackBasic>(); |
| | | nameAndSortedBuffPacks[heroName] = list; |
| | | list.Add(pack); |
| | | } |
| | | |
| | | nameAndSortedBuffPacks.ContainsKey(heroName); |
| | | |
| | | SkillConfig buffConfig = SkillConfig.Get((int)refreshPack.SkillID); |
| | | |
| | | string buffName = buffConfig != null ? buffConfig.SkillName : refreshPack.SkillID.ToString(); |
| | | |
| | | debugInfo += $"[{pack.packUID}] Buff刷新 - ObjID:{refreshPack.ObjID} HeroName:{heroName} BuffID:{refreshPack.BuffID} BuffName:{buffName} IsAdd:{refreshPack.Layer}\n"; |
| | | } |
| | | else if (pack is HB429_tagSCBuffDel delPack) |
| | | { |
| | | string heroName = uidNameDict.ContainsKey(delPack.ObjID) ? uidNameDict[delPack.ObjID] : "Unknown"; |
| | | |
| | | HB428_tagSCBuffRefresh buffPack = buffRefreshList.Find(x => x.BuffID == delPack.BuffID); |
| | | |
| | | // SkillConfig buffConfig = SkillConfig.Get((int)buffPack.SkillID); |
| | | |
| | | // string buffName = buffConfig != null ? buffConfig.SkillName : buffPack.SkillID.ToString(); |
| | | |
| | | if (nameAndSortedBuffPacks.TryGetValue(heroName, out var list)) |
| | | { |
| | | list.Add(pack); |
| | | } |
| | | else |
| | | { |
| | | list = new List<GameNetPackBasic>(); |
| | | nameAndSortedBuffPacks[heroName] = list; |
| | | list.Add(pack); |
| | | } |
| | | |
| | | debugInfo += $"[{pack.packUID}] Buff删除 - ObjID:{delPack.ObjID} HeroName:{heroName} BuffID:{delPack.BuffID} \n\n\n\n\n\n"; |
| | | } |
| | | } |
| | | |
| | | foreach (var heroPackPair in nameAndSortedBuffPacks) |
| | | { |
| | | debugInfo += $"=== {heroPackPair.Key} Buff变更记录 ===\n"; |
| | | foreach (var pack in heroPackPair.Value) |
| | | { |
| | | if (pack is HB428_tagSCBuffRefresh refreshPack) |
| | | { |
| | | SkillConfig buffConfig = SkillConfig.Get((int)refreshPack.SkillID); |
| | | |
| | | string buffName = buffConfig != null ? buffConfig.SkillName : refreshPack.SkillID.ToString(); |
| | | |
| | | debugInfo += $"[{pack.packUID}] Buff刷新 - ObjID:{refreshPack.ObjID} BuffID:{refreshPack.BuffID} BuffName:{buffName} Layer:{refreshPack.Layer}\n"; |
| | | } |
| | | else if (pack is HB429_tagSCBuffDel delPack) |
| | | { |
| | | debugInfo += $"[{pack.packUID}] Buff删除 - ObjID:{delPack.ObjID} BuffID:{delPack.BuffID} \n"; |
| | | } |
| | | } |
| | | debugInfo += "\n"; |
| | | } |
| | | |
| | | string filePath = Application.dataPath + "/../BattleReport/BuffStatusChange_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt"; |
| | | System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(filePath)); |
| | | System.IO.File.WriteAllText(filePath, debugInfo); |
| | | } |
| | | |
| | | #endif |
| | | |
| | | private string PrintPackListDetail(List<GameNetPackBasic> packList, int indent, string guid = "") |
| | | { |
| | | string result = string.Empty; |