修正天梯
This commit is contained in:
@@ -73,7 +73,7 @@ namespace TcgEngine.UI
|
||||
break;
|
||||
}
|
||||
|
||||
if (rankScore == 0)
|
||||
if (rankScore != 0)
|
||||
{
|
||||
this.rankScore.gameObject.SetActive(true);
|
||||
this.stars.gameObject.SetActive(false);
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace TcgEngine.UI
|
||||
public List<RankLine> lines = new List<RankLine>();
|
||||
public List<LadderRankLine> ladderLines = new List<LadderRankLine>();
|
||||
|
||||
private const string DefaultAvatarId = "bear";
|
||||
|
||||
private static LeaderboardPanel instance;
|
||||
|
||||
#region 临时方法
|
||||
@@ -216,6 +218,7 @@ namespace TcgEngine.UI
|
||||
int previous_index = 0;
|
||||
|
||||
|
||||
|
||||
if (users == null || users.Length == 0)
|
||||
{
|
||||
Debug.LogError("玩家数据为空");
|
||||
@@ -228,7 +231,7 @@ namespace TcgEngine.UI
|
||||
{
|
||||
if (rankData.username == udata.username)
|
||||
{
|
||||
my_ladderLine.SetLine(rankData, index + 1, null, rankData.rankId,
|
||||
my_ladderLine.SetLine(rankData, index + 1, GetAvatar(udata.avatar), rankData.rankId,
|
||||
rankData.rankScore, rankData.stars, true);
|
||||
}
|
||||
|
||||
@@ -236,8 +239,8 @@ namespace TcgEngine.UI
|
||||
{
|
||||
LadderRankLine line = ladderLines[index];
|
||||
int rank_order = (previous_rank == rankData.position) ? previous_index : index;
|
||||
line.SetLine(rankData, rank_order + 1,null, rankData.rankId,
|
||||
rankData.rankScore, rankData.stars, true);
|
||||
line.SetLine(rankData, rank_order + 1,GetAvatar(rankData.avatar), rankData.rankId,
|
||||
rankData.rankScore, rankData.stars, false);
|
||||
previous_rank = rankData.position;
|
||||
previous_index = rank_order;
|
||||
}
|
||||
@@ -284,6 +287,15 @@ namespace TcgEngine.UI
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Sprite GetAvatar(string id)
|
||||
{
|
||||
string targetId = string.IsNullOrEmpty(id) ? DefaultAvatarId : id;
|
||||
AvatarData avaData = AvatarData.Get(targetId);
|
||||
return avaData != null ? avaData.GetAvatar() : null;
|
||||
}
|
||||
|
||||
|
||||
public override void Show(bool instant = false)
|
||||
{
|
||||
base.Show(instant);
|
||||
|
||||
Reference in New Issue
Block a user