using System.Collections;
using System.Collections.Generic;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class UI_TopTipPanel : BasePanel
{
///
/// 面板显示后几秒后消失
///
private float disappear = 5f;
public void Init(string title, string content, bool isHide)
{
disappear = 5f;
GetControl("Text_Title").text = title;
GetControl("Text_Content").text = content;
GetControl("Text_Content").GetComponent().SetLayoutVertical();
var height = GetControl("Text_Content").rectTransform.sizeDelta.y + 60 + 40;
GetControl("Image_BackGround").rectTransform.sizeDelta = new Vector2(640, height);
if (isHide)
Hide();
}
///
/// 面板消失
///
private void Hide()
{
StopCoroutine(HideAsync());
StartCoroutine(HideAsync());
}
private IEnumerator HideAsync()
{
yield return new WaitForSeconds(disappear);
UIManager.Instance.HidePanel();
}
}