35 lines
1022 B
C#
35 lines
1022 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class NotificationPopupUI : MonoBehaviour
|
|
{
|
|
private TextMeshProUGUI _title;
|
|
private TextMeshProUGUI _description;
|
|
private Animator _animator;
|
|
|
|
private void Awake()
|
|
{
|
|
_title = transform.Find("Title").GetComponent<TextMeshProUGUI>();
|
|
_description = transform.Find("Description").GetComponent<TextMeshProUGUI>();
|
|
_animator = GetComponent<Animator>();
|
|
transform.gameObject.SetActive(true);
|
|
transform.GetComponent<CanvasGroup>().alpha = 0;
|
|
}
|
|
|
|
public IEnumerator Show(string title, string content)
|
|
{
|
|
if (!transform.gameObject.activeSelf)
|
|
transform.gameObject.SetActive(true);
|
|
transform.GetComponent<CanvasGroup>().alpha = 0;
|
|
|
|
_title.text = title;
|
|
_description.text = content;
|
|
_animator.Play("In");
|
|
yield return new WaitForSeconds(3f);
|
|
_animator.Play("Out");
|
|
}
|
|
}
|