using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class PvpRankPanel : MonoBehaviour { public static PvpRankPanel Instance; private void Awake() { Instance = this; } private void OnDestroy() { Instance = null; } private PvpInfo pvpInfo = null; private void OnEnable() { if(pvpInfo == null) pvpInfo = GameManager.gameManager.PlayerDataPool.pvpIfo; ReqRankInfo(); InitSelfSegmentDesc(); } public UIContainerBase _RankItemContainer; public Text _SelfSegmentDesc; public Text _SelfRank; void ReqRankInfo() { ReqGetHonorBattleFieldRankInfo req = new ReqGetHonorBattleFieldRankInfo(); req.Flag = 1; req.SendMsg(); } public void OnPacket(RespGetHonorBattleFieldRankInfo packet) { _RankItemContainer.InitContentItem(packet.RankList); var hasFind = false; for(int index = 0; index < packet.RankList.Count; index++) { if((ulong)packet.RankList[index].Guid == GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid) { hasFind = true; _SelfRank.text = packet.RankList[index].Rank.ToString(); } } if (!hasFind) _SelfRank.text = GCGame.Table.StrDictionary.GetClientDictionaryString("#{2049}"); } void InitSelfSegmentDesc() { _SelfSegmentDesc.text = pvpInfo.GetSegmentLevelDesc(pvpInfo.PvpSegmentLevel); } public void OnCloseBtn() { UIManager.CloseUI(UIInfo.PvpRankPanel); } }