| | |
| | | |
| | | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using LitJson; |
| | | |
| | | public partial class BattleSettlementManager : GameSystemManager<BattleSettlementManager> |
| | | { |
| | | //结算后需清除 |
| | | //结算后需清除 <battleName,JsonData> |
| | | Dictionary<string, JsonData> battleSettlementDic = new Dictionary<string, JsonData>(); |
| | | public string notifyGuid = string.Empty; |
| | | |
| | | // public string notifyGuid = string.Empty; |
| | | |
| | | public override void Init() |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | 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) |
| | | public void AddPop(string battleName, int result) |
| | | { |
| | | if (string.Empty == _guid) |
| | | return; |
| | | |
| | | battleSettlementDic[_guid] = _data; |
| | | notifyGuid = _guid; |
| | | if (_data.ContainsKey("winFaction")) |
| | | bool isWin = result == 1; |
| | | switch (battleName) |
| | | { |
| | | var result = (int)_data["winFaction"]; |
| | | case "ArenaBattleField": |
| | | PopupWindowsProcessor.Instance.Add(isWin ? "ArenaBattleVictoryWin" : "ArenaBattleFailWin", false); |
| | | break; |
| | | default: |
| | | PopupWindowsProcessor.Instance.Add(isWin ? "BattleVictoryWin" : "BattleFailWin", false); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | var battle = BattleManager.Instance.GetBattleField(_guid); |
| | | if (battle == null) |
| | | return; |
| | | if (battle is ArenaBattleField) |
| | | { |
| | | if (result == 1) |
| | | public void ShowResultWin(string battleName, int result) |
| | | { |
| | | bool isWin = result == 1; |
| | | switch (battleName) |
| | | { |
| | | case "ArenaBattleField": |
| | | if (isWin) |
| | | { |
| | | UIManager.Instance.OpenWindow<ArenaBattleVictoryWin>(); |
| | | } |
| | |
| | | { |
| | | UIManager.Instance.OpenWindow<ArenaBattleFailWin>(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (result == 1) |
| | | break; |
| | | default: |
| | | if (isWin) |
| | | { |
| | | UIManager.Instance.OpenWindow<BattleVictoryWin>(); |
| | | } |
| | |
| | | { |
| | | UIManager.Instance.OpenWindow<BattleFailWin>(); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | public void WinShowOver(string _guid) |
| | | //"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.Remove(_guid); |
| | | if (string.Empty == _guid) |
| | | return; |
| | | var battle = BattleManager.Instance.GetBattleField(_guid); |
| | | if (battle == null) |
| | | return; |
| | | var battleName = battle.ToString(); |
| | | battleSettlementDic[battleName] = _data; |
| | | |
| | | string activeBattleName = BattleManager.Instance.GetActiveBattleName(); |
| | | |
| | | if (_data.ContainsKey("winFaction")) |
| | | { |
| | | var result = (int)_data["winFaction"]; |
| | | if (battleName == activeBattleName) |
| | | { |
| | | //自己场景结算 |
| | | ShowResultWin(battleName, result); |
| | | } |
| | | else |
| | | { |
| | | AddPop(battleName, result); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | public void WinShowOver(string battleName) |
| | | { |
| | | battleSettlementDic.Remove(battleName); |
| | | |
| | | var battle = BattleManager.Instance.GetActiveBattleFieldByName(battleName); |
| | | if (battle != null) |
| | | battle.WhaleFall(); |
| | | } |
| | | |
| | | public JsonData GetBattleSettlement(string _guid) |
| | | public JsonData GetBattleSettlement(string battleName) |
| | | { |
| | | if (!battleSettlementDic.ContainsKey(_guid)) |
| | | if (!battleSettlementDic.ContainsKey(battleName)) |
| | | { |
| | | return null; |
| | | } |
| | | return battleSettlementDic[_guid]; |
| | | return battleSettlementDic[battleName]; |
| | | } |
| | | } |
| | | |