| | |
| | | using UnityEngine; |
| | | using LitJson; |
| | | using System; |
| | | using System.Linq; |
| | | |
| | | public class BattleManager : GameSystemManager<BattleManager> |
| | | { |
| | |
| | | QuickSetting.Instance.SendPackage(); |
| | | } |
| | | } |
| | | |
| | | public readonly int[] speedIndexfuncIdArr = new int[] { 34, 35, 36 }; // 战斗倍数对应的功能ID |
| | | public readonly int passFuncId = 33; // 跳过战斗对应的功能ID |
| | | public int passRound; // 超过X回合可跳过 |
| | | public int fightGuideID; |
| | | public int fightGuideMainLevelLimit; |
| | | public int fightGuideNoClickSeconds; |
| | | public int[] challengeBossGuides; |
| | | |
| | | public Action<string, BattleField> onBattleFieldCreate; |
| | | |
| | |
| | | fightGuideID = int.Parse(config.Numerical1); |
| | | fightGuideMainLevelLimit = int.Parse(config.Numerical2); |
| | | fightGuideNoClickSeconds = int.Parse(config.Numerical3); |
| | | challengeBossGuides = JsonMapper.ToObject<int[]>(config.Numerical4); |
| | | |
| | | config = FuncConfigConfig.Get("BattleButton"); |
| | | passRound= int.Parse(config.Numerical1); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (!allow) |
| | | { |
| | | _package.socketType = ServerType.MainFight; |
| | | packQueue.Enqueue(_package); |
| | | } |
| | | } |
| | |
| | | |
| | | List<GameNetPackBasic> newPackList = ParseBattlePackList(string.Empty, packQueueSnapshot); |
| | | |
| | | #if UNITY_EDITOR |
| | | Action printNewPack = () => |
| | | { |
| | | string temp = "After AnalysisPackQueueAndDistribute newPackList count: " + newPackList.Count + "\n"; |
| | |
| | | }; |
| | | |
| | | printNewPack(); |
| | | |
| | | #endif |
| | | // HashSet<int> skipIndexes = new HashSet<int>(); |
| | | |
| | | // // 这里已经是按照Dequeue的顺序了 |
| | |
| | | public static List<GameNetPackBasic> ParseBattlePackList(string guid, List<GameNetPackBasic> packQueueSnapshot) |
| | | { |
| | | var list = CustomHB426CombinePack.CombineToSkillPackFromList(guid, packQueueSnapshot); |
| | | string str = "ParseBattlePackList \n"; |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | str += " " + list[i].GetType().Name + "\n"; |
| | | } |
| | | // string str = "ParseBattlePackList \n"; |
| | | // for (int i = 0; i < list.Count; i++) |
| | | // { |
| | | // str += " " + list[i].GetType().Name + "\n"; |
| | | // } |
| | | // BattleDebug.LogError(str); |
| | | return list; |
| | | |
| | |
| | | isCreate = false; |
| | | } |
| | | else |
| | | { |
| | | { |
| | | BattleDebug.LogError("战场已存在 先进行销毁"); |
| | | battleField.Destroy(); |
| | | } |
| | | } |
| | | |
| | | var bf = GetBattleFieldByMapID(MapID); |
| | | if (bf != null && !string.IsNullOrEmpty(guid)) |
| | | { |
| | | BattleDebug.LogError("相同地图ID的战场已存在 先进行销毁"); |
| | | bf.Destroy(); |
| | | } |
| | | |
| | | if (isCreate) |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void DestroyAllBattleField() |
| | | { |
| | | var battleFieldsList = battleFields.Values.ToList(); |
| | | foreach (var battleField in battleFieldsList) |
| | | { |
| | | if (battleField == null) |
| | | continue; |
| | | battleField.Destroy(); |
| | | } |
| | | } |
| | | |
| | | } |