using System; using Api; using UI.Hall; using UnityEngine; using UnityEngine.UI; namespace UI.Items { public class OnlinePlayerItemComp : MonoBehaviour { public Text NameText; public Text PlayerIdText; public Image Avatar; public GameObject InviteButton; private Action _inviteClick; private PlayerInfo _player; public void init(Action OnInviteClick, PlayerInfo dataPlayer) { _inviteClick = OnInviteClick; _player = dataPlayer; refreshUI(); } private void refreshUI() { NameText.text = _player.name; PlayerIdText.text = "ID:"+_player.id + ""; AvatarUtil.DisplayAvatar(Avatar, _player.avatar); } public void A__ClickInvite() { _inviteClick.Invoke(_player.id); } } }