using System; using System.Collections; using System.Collections.Generic; using Api; using UI.Hall; using UnityEngine; using UnityEngine.UI; public class RankItemComp : MonoBehaviour { public GameObject icon1; public GameObject icon2; public GameObject icon3; public Text NumberText; public Text NameText; public Text PlayerIdText; public Image Avatar; public Text ScoreText; private Action _inviteClick; private PlayerInfo _player; private int _no; public void init(Action OnInviteClick, PlayerInfo dataPlayer,int no) { _inviteClick = OnInviteClick; _player = dataPlayer; _no = no; Debug.Log(""+_no); refreshUI(); } private void refreshUI() { icon1.SetActive(_no==1); icon2.SetActive(_no==2); icon3.SetActive(_no==3); NameText.text = _player.name; PlayerIdText.text = "ID:"+_player.id + ""; ScoreText.text = "" + _player.score; NumberText.text = "" + _no; AvatarUtil.DisplayAvatar(Avatar, _player.avatar); } public void A__ClickInvite() { _inviteClick.Invoke(_player.id); } }