UITipsPanel.cs 754 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace Rokid.MRC
  6. {
  7. public class UITipsPanel : UIPanelBase
  8. {
  9. private Text txtDesc;
  10. public float time = 1;
  11. public override void OnInit()
  12. {
  13. base.OnInit();
  14. txtDesc = transform.Find("TxtLoading").GetComponent<Text>();
  15. }
  16. public void SetDesc(string desc)
  17. {
  18. gameObject.SetActive(true);
  19. txtDesc.text = desc;
  20. UIManager.Instance.StartCoroutine(WaitAndClose());
  21. }
  22. IEnumerator WaitAndClose()
  23. {
  24. yield return new WaitForSeconds(time);
  25. gameObject.SetActive(false);
  26. }
  27. }
  28. }