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/ChatHistoryItem.cs | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Chat/ChatHistoryItem.cs (limited to 'Client/Assets/Scripts/XMainClient/Chat/ChatHistoryItem.cs') 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.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.singleton.Close(this.mStr); + } + } +} -- cgit v1.1-26-g67d0