You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
977 B
32 lines
977 B
4 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class ChatTextItem_Private : ItemBase<ChatTextMessage>
|
||
|
{
|
||
|
public Text TextContent;
|
||
|
public Image Background;
|
||
|
public override void Init()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
public override void UpdateItemData()
|
||
|
{
|
||
|
TextContent.text = Data.Data;
|
||
|
}
|
||
|
|
||
|
public override void UpdateItemSize()
|
||
|
{
|
||
|
TextContent.GetComponent<ContentSizeFitter>().SetLayoutVertical();
|
||
|
Vector2 size = Background.GetComponent<RectTransform>().sizeDelta;
|
||
|
size.x = TextContent.GetComponent<RectTransform>().sizeDelta.x + 20;
|
||
|
size.y = TextContent.GetComponent<RectTransform>().sizeDelta.y + 20;
|
||
|
Background.GetComponent<RectTransform>().sizeDelta = size;
|
||
|
RectTransform tf = gameObject.GetComponent<RectTransform>();
|
||
|
float y = size.y < 75 ? 75 : size.y;
|
||
|
tf.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, y);
|
||
|
}
|
||
|
}
|