using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PvpRankInfoItem : UIItemBase {

    public List<GameObject> _RankIcon;
    public Text _Rank;
    public Text _Name;
    public Text _ServerName;
    public Text _SegmentDesc;
    public Text _Score;

    public override void Show(Hashtable hash)
    {
        base.Show(hash);

        HonorBattleFieldRankInfo info = (HonorBattleFieldRankInfo)hash["InitObj"];
        if(info.Rank <= 3)
        {
            _Rank.gameObject.SetActive(false);
            for (int index = 0; index < _RankIcon.Count; index++)
            {
                _RankIcon[index].SetActive((index + 1) == info.Rank);
            }
        }else
        {
            _Rank.gameObject.SetActive(true);
            for (int index = 0; index < _RankIcon.Count; index++)
            {
                _RankIcon[index].SetActive(false);
            }
            _Rank.text = info.Rank.ToString();
        }

        _Name.text = info.Name;
        _ServerName.text = info.ServerName;
        //var ServerData = LoginData.GetServerListDataByID(info.ServerId);
        //if(ServerData != null)
        // _ServerName.text = ServerData.m_name;
        //else
        //    _ServerName.text = "";
        _SegmentDesc.text = GameManager.gameManager.PlayerDataPool.pvpIfo.GetSegmentLevelDesc(info.Segment);

        _Score.text = info.Score + "";
    }

}