| | |
| | | if (!battleReportDict.TryGetValue(guid, out queue)) |
| | | { |
| | | queue = new Queue<GameNetPackBasic>(); |
| | | battleReportDict.Add(guid, queue); |
| | | } |
| | | |
| | | queue.Enqueue(vNetPack); |
| | |
| | | battlePackRelationList.Add(guid, uidList); |
| | | } |
| | | |
| | | uidList.Add(vNetPack.packUID); |
| | | if (!uidList.Contains(vNetPack.packUID)) |
| | | { |
| | | uidList.Add(vNetPack.packUID); |
| | | } |
| | | } |
| | | |
| | | public void PushPackUID(string guid, ulong packUID) |
| | | { |
| | | List<ulong> uidList = null; |
| | | |
| | | if (!battlePackRelationList.TryGetValue(guid, out uidList)) |
| | | { |
| | | uidList = new List<ulong>(); |
| | | battlePackRelationList.Add(guid, uidList); |
| | | } |
| | | |
| | | if (!uidList.Contains(packUID)) |
| | | { |
| | | uidList.Add(packUID); |
| | | } |
| | | } |
| | | |
| | | public BattleField GetBattleField(ulong packUID) |
| | |
| | | { |
| | | Queue<GameNetPackBasic> queue = null; |
| | | |
| | | |
| | | if (!battleReportDict.TryGetValue(guid, out queue)) |
| | | { |
| | | BattleDebug.LogError("DistributeNextReportPackage could not find queue for guid : " + guid); |
| | |
| | | |
| | | var pack = queue.Dequeue(); |
| | | |
| | | PackageRegedit.Distribute(pack); |
| | | // Debug.LogError("DistributeNextReportPackage for guid : " + guid + " pack type : " + pack.GetType()); |
| | | |
| | | try |
| | | { |
| | | if (pack is CustomHB426CombinePack combinePack) |
| | | { |
| | | combinePack.Distribute(); |
| | | } |
| | | else if (pack is CustomB421ActionPack actionPack) |
| | | { |
| | | actionPack.Distribute(); |
| | | } |
| | | else |
| | | { |
| | | PackageRegedit.Distribute(pack); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Debug.LogError("DistributeNextPackage: 分发包异常 " + ex); |
| | | // 出错时主动移除当前包,防止死循环 |
| | | if (packQueue.Count > 0) |
| | | { |
| | | packQueue.Dequeue(); |
| | | } |
| | | } |
| | | |
| | | if (queue.Count <= 0) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | onBattleFieldDestroy?.Invoke(battleField.guid, battleField); |
| | | battleField.Release(); |
| | | |
| | | string guid = battleField.guid; |
| | | |
| | | if (battleFields.ContainsKey(guid)) |
| | | { |
| | | battleFields.Remove(guid); |
| | | } |
| | | battleFields.Remove(guid); |
| | | battleReportDict.Remove(guid); |
| | | battlePackRelationList.Remove(guid); |
| | | |
| | | if (storyBattleField == battleField) |
| | | { |
| | |
| | | } |
| | | |
| | | GameObject.DestroyImmediate(battleField.battleRootNode.gameObject); |
| | | |
| | | onBattleFieldDestroy?.Invoke(battleField.guid, battleField); |
| | | |
| | | } |
| | | |
| | | |