RealWorldTerrainResources.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* INFINITY CODE */
  2. /* https://infinity-code.com */
  3. using UnityEditor;
  4. using UnityEngine;
  5. namespace InfinityCode.RealWorldTerrain
  6. {
  7. public static class RealWorldTerrainResources
  8. {
  9. private static Texture2D _deleteIcon;
  10. private static Texture2D _finishIcon;
  11. private static Texture2D _helpIcon;
  12. private static GUIStyle _helpStyle;
  13. private static Texture2D _openIcon;
  14. private static Texture2D _saveIcon;
  15. private static Texture2D _rawIcon;
  16. private static Texture2D _refreshIcon;
  17. private static Texture2D _utilsIcon;
  18. private static Texture2D _resizeIcon;
  19. private static Texture2D _warningIcon;
  20. private static Texture2D _wizardIcon;
  21. public static Texture2D deleteIcon
  22. {
  23. get
  24. {
  25. if (_deleteIcon == null) _deleteIcon = GetIcon("TrashIcon");
  26. return _deleteIcon;
  27. }
  28. }
  29. public static Texture2D finishIcon
  30. {
  31. get
  32. {
  33. if (_finishIcon == null) _finishIcon = GetIcon("FinishIcon");
  34. return _finishIcon;
  35. }
  36. }
  37. public static Texture2D helpIcon
  38. {
  39. get
  40. {
  41. if (_helpIcon == null) _helpIcon = GetIcon("HelpIcon");
  42. return _helpIcon;
  43. }
  44. }
  45. public static GUIStyle helpStyle
  46. {
  47. get
  48. {
  49. if (_helpStyle == null)
  50. {
  51. _helpStyle = new GUIStyle();
  52. _helpStyle.margin = new RectOffset(0, 0, 2, 0);
  53. }
  54. return _helpStyle;
  55. }
  56. }
  57. public static Texture2D openIcon
  58. {
  59. get
  60. {
  61. if (_openIcon == null) _openIcon = GetIcon("OpenIcon");
  62. return _openIcon;
  63. }
  64. }
  65. public static Texture2D saveIcon
  66. {
  67. get
  68. {
  69. if (_saveIcon == null) _saveIcon = GetIcon("SaveIcon");
  70. return _saveIcon;
  71. }
  72. }
  73. public static Texture2D rawIcon
  74. {
  75. get
  76. {
  77. if (_rawIcon == null) _rawIcon = GetIcon("RawIcon");
  78. return _rawIcon;
  79. }
  80. }
  81. public static Texture2D refreshIcon
  82. {
  83. get
  84. {
  85. if (_refreshIcon == null) _refreshIcon = GetIcon("RWT");
  86. return _refreshIcon;
  87. }
  88. }
  89. public static Texture2D utilsIcon
  90. {
  91. get
  92. {
  93. if (_utilsIcon == null) _utilsIcon = GetIcon("UtilsIcon");
  94. return _utilsIcon;
  95. }
  96. }
  97. public static Texture2D resizeIcon
  98. {
  99. get
  100. {
  101. if (_resizeIcon == null) _resizeIcon = GetIcon("ResizeIcon");
  102. return _resizeIcon;
  103. }
  104. }
  105. public static Texture2D warningIcon
  106. {
  107. get
  108. {
  109. if (_warningIcon == null) _warningIcon = GetIcon("WarningIcon");
  110. return _warningIcon;
  111. }
  112. }
  113. public static Texture2D wizardIcon
  114. {
  115. get
  116. {
  117. if (_wizardIcon == null) _wizardIcon = GetIcon("WizardIcon");
  118. return _wizardIcon;
  119. }
  120. }
  121. public static Texture2D GetIcon(string name)
  122. {
  123. return AssetDatabase.LoadAssetAtPath(RealWorldTerrainEditorUtils.assetPath + "Icons/" + name + ".png", typeof(Texture2D)) as Texture2D;
  124. }
  125. }
  126. }