CutePet/Assets/Scripts/GameScene/Object/RankItem2.cs
2024-10-25 11:10:04 +08:00

43 lines
939 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.U2D;
using UnityEngine.UI;
public class RankItem2 : MonoBehaviour
{
//用户头像
public Image imgUserPic;
//播放按钮
public Button btnPlaying;
//昵称
public Text txtName;
//名次文字
public Text txtRanking;
//分数
public Text txtScore;
// Start is called before the first frame update
void Start()
{
//点击播放按钮做什么
btnPlaying.onClick.AddListener(() => { });
}
public void InitInfo(PlayerData info,int i)
{
//更新按钮上的信息
txtName.text = "昵称:" + info.username;
txtScore.text = info.weekScore.ToString();
txtRanking.text = i.ToString();
//加载图集
SpriteAtlas sa = Resources.Load<SpriteAtlas>("Atlas/RankPanel");
//默认头像
imgUserPic.sprite = sa.GetSprite("frame_head");
}
}