73 lines
2.0 KiB
C#
73 lines
2.0 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.Networking;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class RankAllPanel : BasePanel
|
|||
|
{
|
|||
|
public Button btnClose;
|
|||
|
public Button btnHelp;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public Text txtRank;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public Text txtName;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҷ<EFBFBD><D2B7><EFBFBD>
|
|||
|
public Text txtScore;
|
|||
|
|
|||
|
public ScrollRect svRank;
|
|||
|
|
|||
|
|
|||
|
public override void Init()
|
|||
|
{
|
|||
|
btnClose.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
UIManager.Instance.HidePanel<RankAllPanel>(false);
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public void UpdatePanel(List<PlayerData> rankData)
|
|||
|
{
|
|||
|
for (int i = 0; i < rankData.Count; i++)
|
|||
|
{
|
|||
|
//<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if (i < 3)
|
|||
|
{
|
|||
|
GameObject item = Instantiate(Resources.Load<GameObject>("UI/RankItem1"));
|
|||
|
item.transform.SetParent(svRank.content, false);
|
|||
|
RankItem1 rankItem1 = item.GetComponent<RankItem1>();
|
|||
|
rankItem1.InitInfo(rankData[i], i + 1);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
GameObject item = Instantiate(Resources.Load<GameObject>("UI/RankItem2"));
|
|||
|
item.transform.SetParent(svRank.content, false);
|
|||
|
RankItem2 rankItem2 = item.GetComponent<RankItem2>();
|
|||
|
rankItem2.InitInfo(rankData[i], i + 1);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
UpdatePlayer(GameDataMgr.Instance.rankAllData);
|
|||
|
}
|
|||
|
|
|||
|
public void UpdatePlayer(Dictionary<string, List<PlayerData>> rankData)
|
|||
|
{
|
|||
|
for (int i = 0; i < rankData["UserList"].Count; i++)
|
|||
|
{
|
|||
|
if (GameDataMgr.Instance.player.openId == rankData["UserList"][i].openId)
|
|||
|
{
|
|||
|
txtRank.text = (i+1).ToString();
|
|||
|
txtName.text = GameDataMgr.Instance.player.username;
|
|||
|
txtScore.text = rankData["UserList"][i].weekScore.ToString();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
txtRank.text = "";
|
|||
|
txtName.text = GameDataMgr.Instance.player.username;
|
|||
|
txtScore.text = "<22><>";
|
|||
|
}
|
|||
|
}
|