summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Chat/ChatGroupItem.cs
blob: 6fb8dd82b7961d9c0c1bad714a81a2ef26ca6c40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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<ChatEmotionView, ChatEmotionBehaviour>.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<XChatView, XChatBehaviour>.singleton.ChatGroupId = spr.ID;
			DlgBase<XChatView, XChatBehaviour>.singleton.JumpToGroupChat(spr);
		}
	}
}