Toast.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using EZXR.Glass.Core;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using TMPro;
  5. using UnityEngine;
  6. namespace EZXR.Glass.UI
  7. {
  8. public class Toast : MonoBehaviour
  9. {
  10. //static Toast instance;
  11. //public static Toast Instance
  12. //{
  13. // get
  14. // {
  15. // if (instance == null)
  16. // {
  17. // instance = Instantiate(Resources.Load<Toast>("Toast"));
  18. // }
  19. // return instance;
  20. // }
  21. //}
  22. public TextMeshProUGUI content;
  23. // Start is called before the first frame update
  24. void Start()
  25. {
  26. }
  27. // Update is called once per frame
  28. void Update()
  29. {
  30. }
  31. public static void Show(string message)
  32. {
  33. Utilities.Android.SendIntent("ToSystem", "com.ezxr.glass.systemui", "Toast", message);
  34. //Instance.content.text = message;
  35. //Instance.gameObject.SetActive(true);
  36. //Instance.StopAllCoroutines();
  37. //Instance.StartCoroutine(Instance.WaitThenHide(duration));
  38. }
  39. //IEnumerator WaitThenHide(float duration)
  40. //{
  41. // yield return new WaitForSeconds(duration);
  42. // Instance.gameObject.SetActive(false);
  43. //}
  44. }
  45. }