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(); txtMsg = trfself.Find("txtMsg").GetComponent(); } 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.PlaySfx(SoundName.BtnPress); ChatMgr.SSelectChat(itemID); } }