summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Chat/ChatHistoryItem.cs
blob: 5239de763ddb8d0b60a6c13ee4a07721b13cbe1d (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
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;

namespace XMainClient
{
	public class ChatHistoryItem : MonoBehaviour
	{
		private const int LENGTH = 60;

		private IXUILabelSymbol m_symbol;

		private string mStr;

		private void Awake()
		{
			this.m_symbol = (base.transform.Find("Content").GetComponent("XUILabelSymbol") as IXUILabelSymbol);
		}

		public void Refresh(string chat)
		{
			this.mStr = chat;
			string text = DlgBase<ChatEmotionView, ChatEmotionBehaviour>.singleton.OnParseEmotion(chat);
			int num = text.IndexOf("im=Chat");
			bool flag = num > -1 && num < 12;
			int num2 = 21;
			int num3 = flag ? 30 : 12;
			bool flag2 = flag;
			if (flag2)
			{
				bool flag3 = text.Length > num3 && text.Length > num + num2;
				if (flag3)
				{
					text = text.Substring(0, num + num2) + "...";
				}
			}
			else
			{
				bool flag4 = text.Length >= num3 - 3;
				if (flag4)
				{
					text = text.Substring(0, num3 - 3) + "...";
				}
			}
			this.m_symbol.InputText = text;
		}

		public void OnClick()
		{
			DlgBase<ChatAssistView, ChatAssistBehaviour>.singleton.Close(this.mStr);
		}
	}
}