Files
JJBB/Assets/Project/Script/GUI/Chat/ChatInfoBattleItem.cs

59 lines
1.5 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
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 ChatInfoBattleItem : ChatInfoLogItem
{
public override float GetItemHeight()
{
return _ChatInfo.preferredHeight + 20;
}
protected override bool SetDetailLog()
{
ClearChat();
_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 (_LayoutElement == null)
return;
float bgWidth = _ChatInfoBGMinSize.x;
if (_ChatInfo.preferredWidth + 20 > bgWidth && _ChatInfo.preferredWidth + 20 < _ChatInfo.rectTransform.sizeDelta.x)
{
bgWidth = _ChatInfo.preferredWidth + 20;
}
else if (_ChatInfo.preferredWidth + 20 > _ChatInfo.rectTransform.sizeDelta.x)
{
bgWidth = _ChatInfo.rectTransform.sizeDelta.x + 20;
}
_LayoutElement.minHeight = _ChatInfo.preferredHeight + 20;
_LayoutElement.minWidth = gameObject.GetComponent<RectTransform>().sizeDelta.x;
}
}