TextMediator.cs 835 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8. namespace Bitsplash.DatePicker
  9. {
  10. partial class TextMediator : MonoBehaviour
  11. {
  12. partial void MediateTextMeshProText(string text);
  13. partial void MediateTextMeshProColor(Color color);
  14. public void SetText(string text)
  15. {
  16. MediateTextMeshProText(text);
  17. var comp = GetComponent<Text>();
  18. if (comp != null)
  19. comp.text = text;
  20. }
  21. public void SetColor(Color color)
  22. {
  23. MediateTextMeshProColor(color);
  24. var comp = GetComponent<Text>();
  25. if (comp != null)
  26. comp.color = color;
  27. }
  28. }
  29. }