| using System; | 
| using System.Collections; | 
| using System.Collections.Generic; | 
| using System.Text.RegularExpressions; | 
| using UnityEngine; | 
| using UnityEngine.UI; | 
| namespace vnxbqy.UI | 
| { | 
|     public class BossHurtRankBehaviour : MonoBehaviour | 
|     { | 
|         [SerializeField] List<Text> playerNameTexts; | 
|         [SerializeField] List<Text> valueTexts; | 
|         [SerializeField] List<Button> helpBtns; | 
|         [SerializeField] Text mineValueText; | 
|   | 
|   | 
|         int currentDugeonId = 0; | 
|   | 
|         private object RegexPlayerDatas; | 
|   | 
|         DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } | 
|         TeamModel m_TeamModel { get { return ModelCenter.Instance.GetModel<TeamModel>(); } } | 
|   | 
|         public void Init(int mapID) | 
|         { | 
|             currentDugeonId = mapID; | 
|             SetMineInfo(0, 0); | 
|             SetDefault(); | 
|             UpdateBossHurtRankEvent(); | 
|         } | 
|   | 
|         private void OnEnable() | 
|         { | 
|             model.UpdateBossHurtRankEvent += UpdateBossHurtRankEvent; | 
|         } | 
|   | 
|         private void UpdateBossHurtRankEvent() | 
|         { | 
|   | 
|             int i = 0; | 
|             if (model.selectHurtModel == 1) | 
|             { | 
|                 for (i = 0; i < model.BossHurtRank.bossHurtInfo.Count; i++) | 
|                 { | 
|                     if (i < playerNameTexts.Count) | 
|                     { | 
|                         playerNameTexts[i].text = model.BossHurtRank.bossHurtInfo[i].HurtName + | 
|                         (model.BossHurtRank.bossHurtInfo[i].HurtType == 2 ? Language.Get("ChatType_Team") : ""); | 
|                         valueTexts[i].text = UIHelper.ReplaceLargeNum(model.BossHurtRank.bossHurtInfo[i].totalHurt); | 
|   | 
|                         //自己,自己队伍,协助对象(队伍) 不显示; | 
|                         bool isShowHelp = true; | 
|                         if (model.BossHurtRank.bossHurtInfo[i].HurtID == 0) | 
|                         { | 
|                             isShowHelp = false; | 
|                         } | 
|                         //else if (CrossServerUtility.IsCrossServer()) | 
|                         //{ | 
|                         //    isShowHelp = false; | 
|                         //} | 
|                         else if (model.BossHurtRank.bossHurtInfo[i].HurtType == 1  | 
|                         && PlayerDatas.Instance.baseData.PlayerID == model.BossHurtRank.bossHurtInfo[i].HurtID) | 
|                         { | 
|                             isShowHelp = false; | 
|                         } | 
|                         else if (model.BossHurtRank.bossHurtInfo[i].HurtType == 2  | 
|                         && m_TeamModel.myTeam.teamId == model.BossHurtRank.bossHurtInfo[i].HurtID) | 
|                         { | 
|                             isShowHelp = false; | 
|                         } | 
|                         else if (PlayerDatas.Instance.baseData.ExAttr1 != 0 && model.BossHurtRank.bossHurtInfo[i].HurtType == 2) | 
|                         { | 
|                             var assistActor = GAMgr.Instance.GetBySID(PlayerDatas.Instance.baseData.ExAttr1) as GA_Player; | 
|                             if (assistActor != null && assistActor.ActorInfo.teamID == model.BossHurtRank.bossHurtInfo[i].HurtID) | 
|                             { | 
|                                 isShowHelp = false; | 
|                             } | 
|                             else if (assistActor == null) | 
|                             { | 
|                                 //无法确认队伍关系的不显示 | 
|                                 isShowHelp = false; | 
|                             } | 
|                         } | 
|                         else if (PlayerDatas.Instance.baseData.ExAttr1 == model.BossHurtRank.bossHurtInfo[i].HurtID) | 
|                         { | 
|                             isShowHelp = false; | 
|                         } | 
|   | 
|   | 
|                         helpBtns[i].SetActive(isShowHelp); | 
|                         var id = (int)model.BossHurtRank.bossHurtInfo[i].HurtID; | 
|                         var name = playerNameTexts[i].text; | 
|                         var inTeam = model.BossHurtRank.bossHurtInfo[i].HurtType == 2 ? 1:0; | 
|                         helpBtns[i].SetListener(()=>{ | 
|                             PlayerDetails.ShowBossHurtPlayer(id, name, inTeam); | 
|                         }); | 
|   | 
|                     } | 
|                 } | 
|             } | 
|             else if (model.selectHurtModel == 2) | 
|             { | 
|                 for (i = 0; i < model.BossHurtRank.assistBossHurtInfo.Count; i++) | 
|                 { | 
|                     if (i < playerNameTexts.Count) | 
|                     { | 
|                         playerNameTexts[i].text = model.BossHurtRank.assistBossHurtInfo[i].playerName; | 
|                         valueTexts[i].text = UIHelper.ReplaceLargeNum(model.BossHurtRank.assistBossHurtInfo[i].totalHurt); | 
|                         helpBtns[i].SetActive(false); | 
|                     } | 
|                 } | 
|             } | 
|             while (i < playerNameTexts.Count) | 
|             { | 
|                 playerNameTexts[i].text = string.Empty; | 
|                 valueTexts[i].text = string.Empty; | 
|                 helpBtns[i].SetActive(false); | 
|                 i++; | 
|             } | 
|   | 
|             SetMineInfo(0, model.BossHurtRank.hurtValueSelf); | 
|   | 
|         } | 
|   | 
|         private void SetMineInfo(int rank, ulong hurt) | 
|         { | 
|             mineValueText.text = UIHelper.ReplaceLargeNum(hurt); | 
|         } | 
|   | 
|   | 
|   | 
|         private void SetDefault() | 
|         { | 
|             for (int i = 0; i < playerNameTexts.Count; i++) | 
|             { | 
|                 playerNameTexts[i].text = string.Empty; | 
|             } | 
|             for (int i = 0; i < valueTexts.Count; i++) | 
|             { | 
|                 valueTexts[i].text = string.Empty; | 
|             } | 
|         } | 
|   | 
|         private void OnDisable() | 
|         { | 
|             model.UpdateBossHurtRankEvent -= UpdateBossHurtRankEvent; | 
|             mineValueText.text = string.Empty; | 
|         } | 
|     } | 
| } |