diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/Chat/ChatHistoryItem.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/Chat/ChatHistoryItem.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/Chat/ChatHistoryItem.cs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/Chat/ChatHistoryItem.cs b/Client/Assets/Scripts/XMainClient/Chat/ChatHistoryItem.cs new file mode 100644 index 00000000..5239de76 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Chat/ChatHistoryItem.cs @@ -0,0 +1,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);
+ }
+ }
+}
|