源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 line
753 B

  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class UIFontDirty : MonoBehaviour
  5. {
  6. bool isDirty = false;
  7. Font dirtyFont = null;
  8. void Awake()
  9. {
  10. Font.textureRebuilt += delegate (Font font1)
  11. {
  12. isDirty = true;
  13. dirtyFont = font1;
  14. };
  15. }
  16. void LateUpdate()
  17. {
  18. if (isDirty)
  19. {
  20. isDirty = false;
  21. foreach (Text text in GameObject.FindObjectsOfType<Text>())
  22. {
  23. if (text.font == dirtyFont)
  24. {
  25. text.FontTextureChanged();
  26. }
  27. }
  28. print("textureRebuilt -->> " + dirtyFont.name);
  29. dirtyFont = null;
  30. }
  31. }
  32. }