You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

55 lines
1.3 KiB

using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class EScrChat : EScrCell
{
private Image imgIcon;
private TextMeshProUGUI txtMsg;
public override void InitCell()
{
Transform trfself = transform;
imgIcon = trfself.Find("icon").GetComponent<Image>();
txtMsg = trfself.Find("txtMsg").GetComponent<TextMeshProUGUI>();
}
public override void SetData(int itemid)
{
itemID = itemid;
int index = ChatMgr.SGetChatIndex(itemid);
if (index < 0)
return;
string strid = ChatMgr.SGetChatId(index);
string strname = ChatMgr.SGetChatName(index);
string strmsg = ChatMgr.SGetChatMsg(index);
int iicon = ChatMgr.SGetChatIcon(index);
int ititle = ChatMgr.SGetChatTitle(index);
int irank = ChatMgr.SGetChatRank(index);
gameObject.SetActive(true);
imgIcon.sprite = AddressableMgr.GetPlayerIcon(iicon);
string struser = FormatString.GetChatName(irank, ititle, strname);
txtMsg.text = FormatString.CombineStringWithBreakLine(struser, strmsg);
}
public override void RefreshCellView()
{
base.RefreshCellView();
SetData(itemID);
}
public void BtnSelf()
{
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
ChatMgr.SSelectChat(itemID);
}
}