using System.Collections.Generic; using LitJson; public partial class BattleSettlementManager : GameSystemManager { //结算后需清除 Dictionary battleSettlementDic = new Dictionary(); public string notifyGuid = string.Empty; public override void Init() { DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitialize; EventBroadcast.Instance.AddListener(EventName.BATTLE_END, OnSettlement); } public override void Release() { DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitialize; EventBroadcast.Instance.RemoveListener(EventName.BATTLE_END, OnSettlement); } 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) { if (string.Empty == _guid) return; battleSettlementDic[_guid] = _data; notifyGuid = _guid; if (_data.ContainsKey("winFaction")) { var result = (int)_data["winFaction"]; if (result == 1) { UIManager.Instance.OpenWindow(); } else { UIManager.Instance.OpenWindow(); } } } 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]; } }