JJBB/Assets/Project/Script/GUI/Chat/ChatInfoLogItemSysFriend.cs
2024-08-23 15:49:34 +08:00

88 lines
2.7 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using Games.ChatHistory;
using GCGame.Table;
using Games.GlobeDefine;
using GCGame;
using Module.Log;
using Games.Item;
public class ChatInfoLogItemSysFriend : ChatInfoLogItem
{
protected override bool SetDetailLog()
{
ClearChat();
if (_SenderName != null)
{
_SenderName.text = _ChatHistory.SenderName;
_SenderName.gameObject.SetActive(true);
}
if (_SenderIcon != null)
{
string spriteName = _ChatHistory.SenderIcon;
//if (string.Equals(_ChatHistory.SenderName, "1"))
//{
// spriteName = Utils.GetSysIconName(Utils.SysIconType.Sys);
//}
//else if (string.Equals(_ChatHistory.SenderName, "2"))
//{
// spriteName = Utils.GetSysIconName(Utils.SysIconType.Guild);
//}
LoadAssetBundle.Instance.SetImageSprite(_SenderIcon, spriteName);
_SenderIcon.gameObject.SetActive(true);
_SenderIconBG.gameObject.SetActive(true);
}
{
_CannelIcon.gameObject.SetActive(false);
}
if (_ChatHistory.ChatInfo.StartsWith("#"))
{
_ModifiedStr = StrDictionary.GetServerDictionaryFormatString(_ChatHistory.ChatInfo);
}
else
{
_ModifiedStr = _ChatHistory.ChatInfo;
}
GetAllChatLinks(_ChatHistory);
_ModifiedStr = GetLinkedStr(_ChatHistory);
_ChatInfo.text = _ModifiedStr;
_ChatInfo.CalculateLayoutInputHorizontal();
_ChatInfo.CalculateLayoutInputVertical();
SetBGWidth();
StartCoroutine(WaitLayout());
return true;
}
//protected override void SetBGWidth()
//{
// if (_ChatInfoBG == null)
// return;
// float bgWidth = _ChatInfoBGMinSize.x;
// if (_ChatInfo.preferredWidth + 20 > bgWidth && _ChatInfo.preferredWidth + 20 < _ChatInfo.rectTransform.sizeDelta.x)
// {
// bgWidth = _ChatInfo.preferredWidth + 17;
// }
// else if (_ChatInfo.preferredWidth + 20 > _ChatInfo.rectTransform.sizeDelta.x)
// {
// bgWidth = _ChatInfo.rectTransform.sizeDelta.x + 17;
// }
// _ChatInfoBG.gameObject.SetActive(true);
// _ChatInfoBG.rectTransform.sizeDelta = new Vector2(bgWidth, Math.Max(_ChatInfoBGMinSize.y, _ChatInfo.preferredHeight + 10));
// _LayoutElement.minHeight = _ChatInfoBG.rectTransform.sizeDelta.y + 60;
// _LayoutElement.minWidth = gameObject.GetComponent<RectTransform>().sizeDelta.x;
//}
}