TMP_Compatibility.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace TMPro
  4. {
  5. // Class used to convert scenes and objects saved in version 0.1.44 to the new Text Container
  6. public static class TMP_Compatibility
  7. {
  8. public enum AnchorPositions { TopLeft, Top, TopRight, Left, Center, Right, BottomLeft, Bottom, BottomRight, BaseLine, None };
  9. /// <summary>
  10. /// Function used to convert text alignment option enumeration format.
  11. /// </summary>
  12. /// <param name="oldValue"></param>
  13. /// <returns></returns>
  14. public static TextAlignmentOptions ConvertTextAlignmentEnumValues(TextAlignmentOptions oldValue)
  15. {
  16. switch ((int)oldValue)
  17. {
  18. case 0:
  19. return TextAlignmentOptions.TopLeft;
  20. case 1:
  21. return TextAlignmentOptions.Top;
  22. case 2:
  23. return TextAlignmentOptions.TopRight;
  24. case 3:
  25. return TextAlignmentOptions.TopJustified;
  26. case 4:
  27. return TextAlignmentOptions.Left;
  28. case 5:
  29. return TextAlignmentOptions.Center;
  30. case 6:
  31. return TextAlignmentOptions.Right;
  32. case 7:
  33. return TextAlignmentOptions.Justified;
  34. case 8:
  35. return TextAlignmentOptions.BottomLeft;
  36. case 9:
  37. return TextAlignmentOptions.Bottom;
  38. case 10:
  39. return TextAlignmentOptions.BottomRight;
  40. case 11:
  41. return TextAlignmentOptions.BottomJustified;
  42. case 12:
  43. return TextAlignmentOptions.BaselineLeft;
  44. case 13:
  45. return TextAlignmentOptions.Baseline;
  46. case 14:
  47. return TextAlignmentOptions.BaselineRight;
  48. case 15:
  49. return TextAlignmentOptions.BaselineJustified;
  50. case 16:
  51. return TextAlignmentOptions.MidlineLeft;
  52. case 17:
  53. return TextAlignmentOptions.Midline;
  54. case 18:
  55. return TextAlignmentOptions.MidlineRight;
  56. case 19:
  57. return TextAlignmentOptions.MidlineJustified;
  58. case 20:
  59. return TextAlignmentOptions.CaplineLeft;
  60. case 21:
  61. return TextAlignmentOptions.Capline;
  62. case 22:
  63. return TextAlignmentOptions.CaplineRight;
  64. case 23:
  65. return TextAlignmentOptions.CaplineJustified;
  66. }
  67. return TextAlignmentOptions.TopLeft;
  68. }
  69. }
  70. }