From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/Chat/ChatGroupItem.cs | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Chat/ChatGroupItem.cs (limited to 'Client/Assets/Scripts/XMainClient/Chat/ChatGroupItem.cs') diff --git a/Client/Assets/Scripts/XMainClient/Chat/ChatGroupItem.cs b/Client/Assets/Scripts/XMainClient/Chat/ChatGroupItem.cs new file mode 100644 index 00000000..6fb8dd82 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Chat/ChatGroupItem.cs @@ -0,0 +1,70 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + public class ChatGroupItem : MonoBehaviour + { + private CBrifGroupInfo data; + + public IXUILabel m_lblName; + + public IXUILabel m_lblCnt; + + public IXUILabel m_lblDate; + + public IXUILabel m_lblRoleName; + + public IXUILabelSymbol m_lblChat; + + public IXUISprite m_sprRedpoint; + + public IXUISprite m_sprRoot; + + private void Awake() + { + this.m_lblName = (base.transform.Find("info/name").GetComponent("XUILabel") as IXUILabel); + this.m_lblCnt = (base.transform.Find("info/cnt").GetComponent("XUILabel") as IXUILabel); + this.m_lblDate = (base.transform.Find("info/time").GetComponent("XUILabel") as IXUILabel); + this.m_lblRoleName = (base.transform.Find("info/role").GetComponent("XUILabel") as IXUILabel); + this.m_lblChat = (base.transform.Find("info/chat").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this.m_sprRedpoint = (base.transform.Find("redpoint").GetComponent("XUISprite") as IXUISprite); + this.m_sprRoot = (base.transform.GetComponent("XUISprite") as IXUISprite); + } + + public void Refresh(CBrifGroupInfo d) + { + this.data = d; + this.m_lblName.SetText(d.name); + DateTime msgtime = d.msgtime; + TimeSpan timeSpan = DateTime.Now - msgtime; + string text = string.Format("{0:D2}:{1:D2}:{2:D2}", msgtime.Hour, msgtime.Minute, msgtime.Second); + bool flag = timeSpan.Days > 0; + if (flag) + { + text = XStringDefineProxy.GetString("CHAT_DAY", new object[] + { + timeSpan.Days + }); + } + this.m_lblDate.SetText(text); + this.m_lblCnt.SetText(XStringDefineProxy.GetString("CHAT_GROUP_MEMBER", new object[] + { + d.memberCnt.ToString() + })); + this.m_lblRoleName.SetText(d.rolename); + this.m_lblChat.InputText = DlgBase.singleton.OnParseEmotion(d.chat); + this.m_sprRedpoint.SetVisible(false); + this.m_sprRoot.ID = this.data.id; + this.m_sprRoot.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnItemClick)); + } + + public void OnItemClick(IXUISprite spr) + { + DlgBase.singleton.ChatGroupId = spr.ID; + DlgBase.singleton.JumpToGroupChat(spr); + } + } +} -- cgit v1.1-26-g67d0