hch
4 天以前 47aa85c49c2f31f6ac728ea66defb1425bae85ba
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
 
 
using System.Collections.Generic;
using LitJson;
 
public partial class BattleSettlementManager : GameSystemManager<BattleSettlementManager>
{
    //结算后需清除
    Dictionary<string, JsonData> battleSettlementDic = new Dictionary<string, JsonData>();
    public string notifyGuid = string.Empty;
 
    public override void Init()
    {
        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitialize;
        EventBroadcast.Instance.AddListener<string, JsonData>(EventName.BATTLE_END, OnSettlement);
 
    }
 
    public override void Release()
    {
        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitialize;
 
    }
 
 
 
    public void OnBeforePlayerDataInitialize()
    {
        battleSettlementDic.Clear();
    }
 
 
    //"Msg":{"itemInfo":[{"ItemID":5,"Count":2},{"ItemID":3,"Count":40}],"winFaction":1,"statInfo":{"1":{"1":{"1":{"NPCID":0,"DefHurt":727,"CureHP":0,"AtkHurt":1891,"ObjID":1,"HeroID":530004},"3":{"NPCID":0,"DefHurt":483,"CureHP":1511,"AtkHurt":782,"ObjID":6,"HeroID":520001},"2":{"NPCID":0,"DefHurt":953,"CureHP":0,"AtkHurt":1712,"ObjID":5,"HeroID":510003}}},"2":{"1":{"1":{"NPCID":10101091,"DefHurt":638,"CureHP":0,"AtkHurt":140,"ObjID":2,"HeroID":610001},"3":{"NPCID":10101092,"DefHurt":625,"CureHP":0,"AtkHurt":126,"ObjID":3,"HeroID":610001},"5":{"NPCID":10101093,"DefHurt":3122,"CureHP":0,"AtkHurt":1897,"ObjID":4,"HeroID":510003}}}}}
    public void OnSettlement(string _guid, JsonData _data)
    {
        battleSettlementDic[_guid] = _data;
        notifyGuid = _guid;
        if (_data.ContainsKey("winFaction"))
        {
            var result = (int)_data["winFaction"];
            if (result == 1)
            {
                UIManager.Instance.OpenWindow<BattleVictoryWin>();
            }
            else
            {
                UIManager.Instance.OpenWindow<BattleFailWin>();
            }
        }
    }
 
    public void WinShowOver(string _guid)
    {
        battleSettlementDic.Remove(_guid);
        var battle = BattleManager.Instance.GetBattleField(_guid);
        if (battle != null)
            battle.WhaleFall();
    }
 
    public JsonData GetBattleSettlement(string _guid)
    {
        if (!battleSettlementDic.ContainsKey(_guid))
        {
            return null;
        }
        return battleSettlementDic[_guid];
    }
}