Icons.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using UnityEngine;
  2. namespace UnityTest
  3. {
  4. public static class Icons
  5. {
  6. public static readonly Texture2D failImg;
  7. public static readonly Texture2D ignoreImg;
  8. public static readonly Texture2D runImg;
  9. public static readonly Texture2D runFailedImg;
  10. public static readonly Texture2D runAllImg;
  11. public static readonly Texture2D successImg;
  12. public static readonly Texture2D unknownImg;
  13. public static readonly Texture2D inconclusiveImg;
  14. public static readonly Texture2D stopwatchImg;
  15. public static readonly Texture2D plusImg;
  16. public static readonly Texture2D gearImg;
  17. public static readonly Texture2D greenredyellowImg1;
  18. public static readonly Texture2D greenredyellowImg2;
  19. public static readonly Texture2D greenredyellowImg3;
  20. public static readonly Texture2D greenredyellowImg4;
  21. public static readonly GUIContent guiUnknownImg;
  22. public static readonly GUIContent guiInconclusiveImg;
  23. public static readonly GUIContent guiIgnoreImg;
  24. public static readonly GUIContent guiSuccessImg;
  25. public static readonly GUIContent guiFailImg;
  26. public static readonly GUIContent guiGreenredyellowImg1;
  27. public static readonly GUIContent guiGreenredyellowImg2;
  28. public static readonly GUIContent guiGreenredyellowImg3;
  29. public static readonly GUIContent guiGreenredyellowImg4;
  30. const string ICONS_PATH = "Assets/Core/UnityTestTools/Common/icons/";
  31. static Icons ()
  32. {
  33. failImg = LoadIcon("red.png");
  34. ignoreImg = LoadIcon("grey.png");
  35. runImg = LoadIcon("play.png");
  36. runFailedImg = LoadIcon("playred.png");
  37. runAllImg = LoadIcon("playall.png");
  38. successImg = LoadIcon("green.png");
  39. unknownImg = LoadIcon("white.png");
  40. inconclusiveImg = LoadIcon("yellow.png");
  41. stopwatchImg = LoadIcon("stopwatch.png");
  42. plusImg = LoadIcon("plus.png");
  43. gearImg = LoadIcon("gear.png");
  44. greenredyellowImg1 = LoadIcon("green-red-yellow1.png");
  45. greenredyellowImg2 = LoadIcon("green-red-yellow2.png");
  46. greenredyellowImg3 = LoadIcon("green-red-yellow3.png");
  47. greenredyellowImg4 = LoadIcon("green-red-yellow4.png");
  48. guiUnknownImg = new GUIContent (unknownImg);
  49. guiInconclusiveImg = new GUIContent (inconclusiveImg);
  50. guiIgnoreImg = new GUIContent (ignoreImg);
  51. guiSuccessImg = new GUIContent (successImg);
  52. guiFailImg = new GUIContent (failImg);
  53. guiGreenredyellowImg1 = new GUIContent (greenredyellowImg1);
  54. guiGreenredyellowImg2 = new GUIContent (greenredyellowImg2);
  55. guiGreenredyellowImg3 = new GUIContent (greenredyellowImg3);
  56. guiGreenredyellowImg4 = new GUIContent (greenredyellowImg4);
  57. }
  58. static Texture2D LoadIcon(string iconName)
  59. {
  60. return null;// (Texture2D)UnityEditor.AssetDatabase.LoadAssetAtPath(ICONS_PATH + iconName, typeof(Texture2D));
  61. }
  62. public static GUIContent GetSpinningIcon ()
  63. {
  64. var frame = ((int) (Time.realtimeSinceStartup * 7)) % 4;
  65. switch (frame)
  66. {
  67. case 0:
  68. return guiGreenredyellowImg1;
  69. case 1:
  70. return guiGreenredyellowImg2;
  71. case 2:
  72. return guiGreenredyellowImg3;
  73. case 3:
  74. return guiGreenredyellowImg4;
  75. default:
  76. return guiGreenredyellowImg1;
  77. }
  78. }
  79. }
  80. }