89 lines
2.2 KiB
C#
89 lines
2.2 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.GlobeDefine;
|
|
|
|
public class RankInfoItem : UIItemBase
|
|
{
|
|
#region
|
|
|
|
public Image _RankIdxImg;
|
|
public Text _RankIdxTx;
|
|
public Text _PlayerName;
|
|
public Text[] _PlayerInfos;
|
|
|
|
public GridLayoutGroup _RankInfoPanel;
|
|
|
|
private PVPData.RankDataItem _RankData;
|
|
#endregion
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show();
|
|
|
|
var rankData = (PVPData.RankDataItem)hash["InitObj"];
|
|
ShowRankItem(rankData);
|
|
}
|
|
|
|
private void ShowRankItem(PVPData.RankDataItem rankData)
|
|
{
|
|
_RankData = rankData;
|
|
|
|
_RankIdxTx.text = _RankData.str1;
|
|
_PlayerName.text = _RankData.str2;
|
|
|
|
int exStrCount = 0;
|
|
if (!string.IsNullOrEmpty(_RankData.str3))
|
|
{
|
|
_PlayerInfos[0].text = _RankData.str3;
|
|
_PlayerInfos[0].gameObject.SetActive(true);
|
|
++exStrCount;
|
|
}
|
|
else
|
|
{
|
|
_PlayerInfos[0].gameObject.SetActive(false);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(_RankData.str4))
|
|
{
|
|
_PlayerInfos[1].text = _RankData.str4;
|
|
_PlayerInfos[1].gameObject.SetActive(true);
|
|
++exStrCount;
|
|
}
|
|
else
|
|
{
|
|
_PlayerInfos[1].gameObject.SetActive(false);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(_RankData.str5))
|
|
{
|
|
_PlayerInfos[2].text = _RankData.str5;
|
|
_PlayerInfos[2].gameObject.SetActive(true);
|
|
++exStrCount;
|
|
}
|
|
else
|
|
{
|
|
_PlayerInfos[2].gameObject.SetActive(false);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(_RankData.str6))
|
|
{
|
|
_PlayerInfos[3].text = _RankData.str6;
|
|
_PlayerInfos[3].gameObject.SetActive(true);
|
|
++exStrCount;
|
|
}
|
|
else
|
|
{
|
|
_PlayerInfos[3].gameObject.SetActive(false);
|
|
}
|
|
|
|
if (exStrCount > 0)
|
|
{
|
|
float exStrWidth = _RankInfoPanel.GetComponent<RectTransform>().sizeDelta.x / exStrCount;
|
|
float exStrHeight = _RankInfoPanel.GetComponent<RectTransform>().sizeDelta.y;
|
|
_RankInfoPanel.cellSize = new Vector2(exStrWidth, exStrHeight);
|
|
}
|
|
}
|
|
|
|
}
|