|  |  |  | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | using LitJson; | 
|---|
|  |  |  | using UnityEngine; | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | using System.Linq; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class BoneBattleField : BattleField | 
|---|
|  |  |  | { | 
|---|
|  |  |  | protected int chapter;//   章节 | 
|---|
|  |  |  | protected int wave;//  波数 | 
|---|
|  |  |  | protected int level;// 关卡 | 
|---|
|  |  |  | protected JsonData extendData; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected MainChapterConfig chapterConfig; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected MainLevelConfig levelConfig; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public BoneBattleField(string _guid) : base(_guid) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | chapter = FuncLineID / 10000; | 
|---|
|  |  |  | wave = MapID == 1 ? FuncLineID % 100 : 1;//第几波怪 | 
|---|
|  |  |  | level = (FuncLineID % 10000) / 100; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int level = FuncLineID;// 关卡 | 
|---|
|  |  |  | extendData = _extendData; | 
|---|
|  |  |  | chapterConfig = MainChapterConfig.Get(chapter); | 
|---|
|  |  |  | levelConfig = MainLevelConfig.Get(level); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SetBattleMode(BattleMode.Record); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override void Release() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | base.Release(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override void AutoSetBattleMode() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override void WhaleFall() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UIManager.Instance.CloseWindow<StoryBossBattleWin>(); | 
|---|
|  |  |  | AutoFightModel.Instance.isPause = false; | 
|---|
|  |  |  | Destroy(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (UIManager.Instance.IsOpened<BoneFieldBattleWin>()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UIManager.Instance.CloseWindow<BoneFieldBattleWin>(); | 
|---|
|  |  |  | UIManager.Instance.OpenWindow<BoneFieldWin>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override void HaveRest() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //  主线BOSS战斗没有休息 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // public override void OnBattleEnd(JsonData turnFightStateData) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     base.OnBattleEnd(turnFightStateData); | 
|---|
|  |  |  | //     // HaveRest(); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override void Run() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | fsBattleWin = UIManager.Instance.OpenWindow<BoneFieldBattleWin>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | fsBattleWin.SetBattleField(this); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (UIManager.Instance.IsOpened<BoneFieldWin>()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UIManager.Instance.CloseWindow<BoneFieldWin>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public NPCLineupConfig GetBossLineupConfig() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!DungeonConfig.TryGetDungeonID(MapID, FuncLineID, out int dungeonID)) | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | if (!DungeonConfig.HasKey(dungeonID)) | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | int[] lineupIDList = DungeonConfig.Get(dungeonID).LineupIDList; | 
|---|
|  |  |  | if (lineupIDList.IsNullOrEmpty()) | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | int lineupID = lineupIDList[0]; | 
|---|
|  |  |  | if (!NPCLineupConfig.HasKey(lineupID)) | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | NPCLineupConfig nPCLineupConfig = NPCLineupConfig.Get(lineupID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return nPCLineupConfig; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override BattleObject FindBoss() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var config = GetBossLineupConfig(); | 
|---|
|  |  |  | if (config != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int bossId = config.BossID; | 
|---|
|  |  |  | BattleObject bo = battleObjMgr.allBattleObjDict.Values.FirstOrDefault(bo => bo.teamHero.NPCID == bossId); | 
|---|
|  |  |  | return bo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|