public void SetData(MailRecvWindow parent, MailData.UserMail data) { if (null == data) { return; } LabelSender.text = data.SenderName; // if (data.text.Length > 6) // { // labelText.text = string.Format("{0}{1}", data.text.Substring(0, 6), "..."); // } // else // { // labelText.text = data.text; // } // labelText.text = data.text; labelTime.text = data.time; SprState.gameObject.SetActive((!data.bReaded || data.itemID >= 0 || data.moneyCount > 0)); m_mailRecvWindow = parent; // ObjOfficialIcon.SetActive(data.senderType == GC_MAIL_UPDATE.MailSender.MAILSENDER_SYS); if (data.senderType == GC_MAIL_UPDATE.MailSender.MAILSENDER_SYS) { ObjOfficialText.text = "官方"; } else { ObjOfficialText.text = ""; } }
public static MailListItem CreateItem(GameObject grid, GameObject resObj, string name, MailRecvWindow parent, MailData.UserMail data) { if (null == data) { LogModule.ErrorLog("receive mail data null:" + name); return(null); } GameObject curItem = Utils.BindObjToParent(resObj, grid, name); if (null != curItem) { MailListItem curItemComponent = curItem.GetComponent <MailListItem>(); if (null != curItemComponent) { curItemComponent.SetData(parent, data); } return(curItemComponent); } return(null); }