yyl
3 天以前 b20b06455ea5bedada2b552a92619a196bc736d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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;
    }
}