| using System; | 
| using LitJson; | 
| using UnityEngine; | 
| using System.Collections.Generic; | 
| using System.Linq; | 
|   | 
|   | 
| public class StoryBossBattleField : BattleField | 
| { | 
|     protected MainLevelConfig levelConfig; | 
|   | 
|     protected MainChapterConfig chapterConfig; | 
|   | 
|     public StoryBossBattleField(string _guid) : base(_guid) | 
|     { | 
|          | 
|     } | 
|   | 
|     public override void Init(int MapID, int FuncLineID, JsonData _extendData, | 
|         List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax) | 
|     { | 
|         int level = FuncLineID;// 关卡 | 
|         extendData = _extendData; | 
|         levelConfig = MainLevelConfig.Get(level); | 
|         chapterConfig = MainChapterConfig.Get(levelConfig.ChapterID); | 
|   | 
|         base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax); | 
|   | 
|         SetBattleMode(BattleMode.Record); | 
|     } | 
|   | 
|     protected override void LoadMap(int mapID) | 
|     { | 
|         if (chapterConfig != null) | 
|         { | 
|             Texture texture = ResManager.Instance.LoadAsset<Texture>("Texture/FullScreenBg", chapterConfig.MapBG); | 
|             battleRootNode.SetBackground(texture); | 
|         } | 
|     } | 
|   | 
|     public override void Release() | 
|     { | 
|         base.Release(); | 
|     } | 
|   | 
|   | 
|     public override void AutoSetBattleMode() | 
|     { | 
|         SetBattleMode(BattleMode.Record); | 
|     } | 
|   | 
|     public override void TurnFightState(int TurnNum, int State, | 
|         uint FuncLineID, JsonData extendData) | 
|     { | 
|         base.TurnFightState(TurnNum, State, FuncLineID, extendData); | 
|   | 
|         switch (State) | 
|         { | 
|             //  起始状态标记 | 
|             case 0: | 
|                 break; | 
|             case 1://准备完毕 | 
|                 break; | 
|             case 2://战斗中 | 
|                 break; | 
|             case 3://战斗结束 | 
|                 break; | 
|             case 4://结算奖励 | 
|                 break; | 
|             case 5://结束状态标记 | 
|                 break; | 
|             default: | 
|                 BattleDebug.LogError("recieve a unknown State"); | 
|                 break; | 
|         } | 
|     } | 
|   | 
|     protected override void OnSettlement(JsonData turnFightStateData) | 
|     { | 
|         base.OnSettlement(turnFightStateData); | 
|     } | 
|   | 
|     public override void WhaleFall() | 
|     { | 
|         UIManager.Instance.CloseWindow<StoryBossBattleWin>(); | 
|         AutoFightModel.Instance.isPause = false; | 
|         Destroy(); | 
|     } | 
|   | 
|      | 
|   | 
|     public override void HaveRest() | 
|     { | 
|         //  主线BOSS战斗没有休息 | 
|     } | 
|   | 
|   | 
|     // public override void OnBattleEnd(JsonData turnFightStateData) | 
|     // { | 
|     //     base.OnBattleEnd(turnFightStateData); | 
|     //     // HaveRest(); | 
|     // } | 
|   | 
|     public override void Run() | 
|     { | 
|         if (operationAgent == null) | 
|         { | 
|             //防范异常 | 
|             return; | 
|         } | 
|         base.Run(); | 
|     } | 
|   | 
|     public override void DistributeNextPackage() | 
|     { | 
|         if (IsBattleFinish) | 
|             return; | 
|              | 
|         //  不要调用base的函数 | 
|         BattleManager.Instance.DistributeNextReportPackage(guid); | 
|     } | 
|   | 
|     public override void ShowWindow(HB424_tagSCTurnFightInit vNetData) | 
|     { | 
|         StoryBossBattleWin fsBattleWin = UIManager.Instance.GetUI<StoryBossBattleWin>();// as FullScreenBattleWin; | 
|         if (null == fsBattleWin) | 
|         { | 
|             fsBattleWin = UIManager.Instance.OpenWindow<StoryBossBattleWin>(); | 
|         } | 
|         fsBattleWin.SetBattleField(this); | 
|     } | 
|   | 
|     public NPCLineupConfig GetBossLineupConfig() | 
|     { | 
|         if (null == levelConfig) | 
|             return null; | 
|   | 
|         int[] bossLineup = levelConfig.BossLineupIDList; | 
|   | 
|         if (bossLineup.IsNullOrEmpty()) | 
|             return null; | 
|   | 
|         var lineupID = bossLineup[0]; | 
|   | 
|         if (lineupID > 0) | 
|         { | 
|             NPCLineupConfig lineupConfig = NPCLineupConfig.Get(lineupID); | 
|             return lineupConfig; | 
|         } | 
|   | 
|         return null; | 
|     } | 
|   | 
|     public override BattleObject FindBoss() | 
|     { | 
|         NPCLineupConfig lineupConfig = GetBossLineupConfig(); | 
|         if (lineupConfig != null) | 
|         { | 
|             int bossId = lineupConfig.BossID; | 
|   | 
|             BattleObject bo = battleObjMgr.allBattleObjDict.Values.FirstOrDefault(bo => bo.teamHero.NPCID == bossId); | 
|   | 
|             return bo; | 
|         } | 
|   | 
|         return null; | 
|     } | 
| } |