Files
JJBB/Assets/Project/Script/GUI/FactionChallenge/FactionPlayerRankInfoItem.cs

54 lines
1.3 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class FactionPlayerRankInfoItem : MonoBehaviour {
#region
public Text RankText;
public Text TotalRankText;
public Text PlayerNameText;
public Text PlayerLevelText;
public Image curRankIcon;
public Image totalRankIcon;
//排名1 2 3
public Sprite[] RankIcon;
#endregion
public void SetRoleInfo(RoleChallengeRankInfo roleInfo)
{
PlayerNameText.text = roleInfo.name;
PlayerLevelText.text = roleInfo.level.ToString();
RankText.text = roleInfo.curRank.ToString();
TotalRankText.text = roleInfo.totalRnak.ToString();
//排名信息
if (roleInfo.curRank > 3)
{
curRankIcon.gameObject.SetActive(false); //屏蔽排名Icon
}else
{
if (roleInfo.curRank != 0)
{
curRankIcon.gameObject.SetActive(true);
curRankIcon.overrideSprite = RankIcon[roleInfo.curRank - 1];
}
}
if (roleInfo.totalRnak > 3)
{
totalRankIcon.gameObject.SetActive(false);
}else
{
totalRankIcon.gameObject.SetActive(true);
totalRankIcon.overrideSprite = RankIcon[roleInfo.totalRnak - 1];
}
}
}