48 lines
1.0 KiB
C#
48 lines
1.0 KiB
C#
using DG.Tweening;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UI_FadePanel : MonoBehaviour
|
|
{
|
|
public static UI_FadePanel Instance;
|
|
public string FadeString;
|
|
|
|
public Image FadeBg;
|
|
/// <summary>
|
|
/// Îı¾
|
|
/// </summary>
|
|
public TextMeshProUGUI FadetextMeshProUGUI;
|
|
public float typeTime;
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
public void Init()
|
|
{
|
|
gameObject.SetActive(true);
|
|
FadeBg.DOFade(1,0.1f);
|
|
StartCoroutine(Typing(FadetextMeshProUGUI, FadeString));
|
|
|
|
}
|
|
|
|
public void HidePanel()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
public IEnumerator Typing(TextMeshProUGUI text ,string a)
|
|
{
|
|
text.text = string.Empty;
|
|
string strTemp = string.Empty;
|
|
for (int i = 0; i < a.Length; i++)
|
|
{
|
|
yield return new WaitForSeconds(typeTime);
|
|
strTemp += a[i];
|
|
text.text = strTemp;
|
|
}
|
|
}
|
|
}
|