checkFontColor.cs 863 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class checkFontColor : MonoBehaviour
  6. {
  7. Color greencolor = new Color(29, 109, 96, 255);
  8. Color bluecolor = new Color(255, 255, 255, 255);
  9. Color redcolor = new Color(255, 255, 255, 255);
  10. private void OnEnable()
  11. {
  12. Invoke("change",1f);
  13. }
  14. void change()
  15. {
  16. if (GetTexture2D.urlbase.Contains("blue"))
  17. {
  18. this.GetComponent<Text>().color = bluecolor;
  19. Debug.Log("蓝色");
  20. }
  21. else if (GetTexture2D.urlbase.Contains("green"))
  22. {
  23. this.GetComponent<Text>().color = greencolor;
  24. Debug.Log("绿色");
  25. }
  26. else
  27. {
  28. this.GetComponent<Text>().color = redcolor;
  29. Debug.Log("红色");
  30. }
  31. }
  32. }