You've already forked taptap2024_GJ_chidouren
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System;
|
|
using Framework.Utils.UITools.CommonScroll;
|
|
using Script.Utils;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Views
|
|
{
|
|
public class CommonRankingNode : ScrollCellLogic
|
|
{
|
|
public Image Avatar;
|
|
public TMP_Text Name;
|
|
public TMP_Text Score;
|
|
public TMP_Text Rank;
|
|
|
|
|
|
private WebImgLoader _avatarLoader;
|
|
|
|
public override void OnInit (IScrollContext context)
|
|
{
|
|
this._avatarLoader = new WebImgLoader ();
|
|
}
|
|
|
|
public override void OnUpdateData (object data, int index)
|
|
{
|
|
var node = (RankingNode) data;
|
|
this.Name.text = node.Name;
|
|
this.Score.text = node.Score;
|
|
this.Rank.text = $"第{node.Rank}名";
|
|
this._avatarLoader?.LoadTexture (node.Avatar , t =>
|
|
{
|
|
this.Avatar.sprite = Sprite.Create (t , new Rect (0 , 0 , t.width , t.height) , new Vector2 (0.5f , 0.5f));
|
|
});
|
|
}
|
|
|
|
public override void OnRefresh (object data)
|
|
{
|
|
}
|
|
|
|
private void OnDisable ()
|
|
{
|
|
this._avatarLoader?.Cancel ();
|
|
}
|
|
}
|
|
} |