HotReloadWindowStyles.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. using UnityEditor;
  2. using UnityEngine;
  3. using System.Reflection;
  4. namespace SingularityGroup.HotReload.Editor {
  5. internal static class HotReloadWindowStyles {
  6. private static GUIStyle h1TitleStyle;
  7. private static GUIStyle h1TitleCenteredStyle;
  8. private static GUIStyle h2TitleStyle;
  9. private static GUIStyle h3TitleStyle;
  10. private static GUIStyle h3TitleWrapStyle;
  11. private static GUIStyle h4TitleStyle;
  12. private static GUIStyle h5TitleStyle;
  13. private static GUIStyle boxStyle;
  14. private static GUIStyle wrapStyle;
  15. private static GUIStyle noPaddingMiddleLeftStyle;
  16. private static GUIStyle middleLeftStyle;
  17. private static GUIStyle middleCenterStyle;
  18. private static GUIStyle mediumMiddleCenterStyle;
  19. private static GUIStyle textFieldWrapStyle;
  20. private static GUIStyle foldoutStyle;
  21. private static GUIStyle h3CenterTitleStyle;
  22. private static GUIStyle logoStyle;
  23. private static GUIStyle changelogPointersStyle;
  24. private static GUIStyle recompileButtonStyle;
  25. private static GUIStyle indicationIconStyle;
  26. private static GUIStyle indicationAlertIconStyle;
  27. private static GUIStyle startButtonStyle;
  28. private static GUIStyle stopButtonStyle;
  29. private static GUIStyle eventFilters;
  30. private static GUIStyle sectionOuterBoxCompactStyle;
  31. private static GUIStyle sectionInnerBoxStyle;
  32. private static GUIStyle sectionInnerBoxWideStyle;
  33. private static GUIStyle changelogSectionInnerBoxStyle;
  34. private static GUIStyle indicationBoxStyle;
  35. private static GUIStyle linkStyle;
  36. private static GUIStyle labelStyle;
  37. private static GUIStyle progressBarBarStyle;
  38. private static GUIStyle section;
  39. private static GUIStyle scroll;
  40. private static GUIStyle barStyle;
  41. private static GUIStyle barBgStyle;
  42. private static GUIStyle barChildStyle;
  43. private static GUIStyle barFoldoutStyle;
  44. private static GUIStyle timestampStyle;
  45. private static GUIStyle clickableLabelBoldStyle;
  46. private static GUIStyle _footerStyle;
  47. private static GUIStyle _emptyListText;
  48. private static GUIStyle _stacktraceTextAreaStyle;
  49. private static GUIStyle _customFoldoutStyle;
  50. private static GUIStyle _entryBoxStyle;
  51. private static GUIStyle _childEntryBoxStyle;
  52. private static GUIStyle _removeIconStyle;
  53. private static GUIStyle upgradeLicenseButtonStyle;
  54. private static GUIStyle upgradeLicenseButtonOverlayStyle;
  55. private static GUIStyle upgradeButtonStyle;
  56. private static GUIStyle hideButtonStyle;
  57. private static GUIStyle dynamicSection;
  58. private static GUIStyle dynamicSectionHelpTab;
  59. private static GUIStyle helpTabButton;
  60. private static GUIStyle indicationHelpBox;
  61. private static GUIStyle notificationsTitleStyle;
  62. private static Color32? darkModeLinkColor;
  63. private static Color32? lightModeModeLinkColor;
  64. public static bool IsDarkMode => EditorGUIUtility.isProSkin;
  65. public static int windowScreenWidth => HotReloadWindow.Current ? (int)HotReloadWindow.Current.position.width : Screen.width;
  66. public static int windowScreenHeight => HotReloadWindow.Current ? (int)HotReloadWindow.Current.position.height : Screen.height;
  67. public static GUIStyle H1TitleStyle {
  68. get {
  69. if (h1TitleStyle == null) {
  70. h1TitleStyle = new GUIStyle(EditorStyles.label);
  71. h1TitleStyle.normal.textColor = EditorStyles.label.normal.textColor;
  72. h1TitleStyle.fontStyle = FontStyle.Bold;
  73. h1TitleStyle.fontSize = 16;
  74. h1TitleStyle.padding.top = 5;
  75. h1TitleStyle.padding.bottom = 5;
  76. }
  77. return h1TitleStyle;
  78. }
  79. }
  80. public static GUIStyle FooterStyle {
  81. get {
  82. if (_footerStyle == null) {
  83. _footerStyle = new GUIStyle();
  84. _footerStyle.fixedHeight = 28;
  85. }
  86. return _footerStyle;
  87. }
  88. }
  89. public static GUIStyle H1TitleCenteredStyle {
  90. get {
  91. if (h1TitleCenteredStyle == null) {
  92. h1TitleCenteredStyle = new GUIStyle(H1TitleStyle);
  93. h1TitleCenteredStyle.alignment = TextAnchor.MiddleCenter;
  94. }
  95. return h1TitleCenteredStyle;
  96. }
  97. }
  98. public static GUIStyle H2TitleStyle {
  99. get {
  100. if (h2TitleStyle == null) {
  101. h2TitleStyle = new GUIStyle(EditorStyles.label);
  102. h2TitleStyle.normal.textColor = EditorStyles.label.normal.textColor;
  103. h2TitleStyle.fontStyle = FontStyle.Bold;
  104. h2TitleStyle.fontSize = 14;
  105. h2TitleStyle.padding.top = 5;
  106. h2TitleStyle.padding.bottom = 5;
  107. }
  108. return h2TitleStyle;
  109. }
  110. }
  111. public static GUIStyle H3TitleStyle {
  112. get {
  113. if (h3TitleStyle == null) {
  114. h3TitleStyle = new GUIStyle(EditorStyles.label);
  115. h3TitleStyle.normal.textColor = EditorStyles.label.normal.textColor;
  116. h3TitleStyle.fontStyle = FontStyle.Bold;
  117. h3TitleStyle.fontSize = 12;
  118. h3TitleStyle.padding.top = 5;
  119. h3TitleStyle.padding.bottom = 5;
  120. }
  121. return h3TitleStyle;
  122. }
  123. }
  124. public static GUIStyle NotificationsTitleStyle {
  125. get {
  126. if (notificationsTitleStyle == null) {
  127. notificationsTitleStyle = new GUIStyle(HotReloadWindowStyles.H3TitleStyle);
  128. notificationsTitleStyle.padding.bottom = 0;
  129. notificationsTitleStyle.padding.top = 0;
  130. }
  131. return notificationsTitleStyle;
  132. }
  133. }
  134. public static GUIStyle H3TitleWrapStyle {
  135. get {
  136. if (h3TitleWrapStyle == null) {
  137. h3TitleWrapStyle = new GUIStyle(H3TitleStyle);
  138. h3TitleWrapStyle.wordWrap = true;
  139. }
  140. return h3TitleWrapStyle;
  141. }
  142. }
  143. public static GUIStyle H3CenteredTitleStyle {
  144. get {
  145. if (h3CenterTitleStyle == null) {
  146. h3CenterTitleStyle = new GUIStyle(EditorStyles.label);
  147. h3CenterTitleStyle.normal.textColor = EditorStyles.label.normal.textColor;
  148. h3CenterTitleStyle.fontStyle = FontStyle.Bold;
  149. h3CenterTitleStyle.alignment = TextAnchor.MiddleCenter;
  150. h3CenterTitleStyle.fontSize = 12;
  151. }
  152. return h3CenterTitleStyle;
  153. }
  154. }
  155. public static GUIStyle H4TitleStyle {
  156. get {
  157. if (h4TitleStyle == null) {
  158. h4TitleStyle = new GUIStyle(EditorStyles.label);
  159. h4TitleStyle.normal.textColor = EditorStyles.label.normal.textColor;
  160. h4TitleStyle.fontStyle = FontStyle.Bold;
  161. h4TitleStyle.fontSize = 11;
  162. }
  163. return h4TitleStyle;
  164. }
  165. }
  166. public static GUIStyle H5TitleStyle {
  167. get {
  168. if (h5TitleStyle == null) {
  169. h5TitleStyle = new GUIStyle(EditorStyles.label);
  170. h5TitleStyle.normal.textColor = EditorStyles.label.normal.textColor;
  171. h5TitleStyle.fontStyle = FontStyle.Bold;
  172. h5TitleStyle.fontSize = 10;
  173. }
  174. return h5TitleStyle;
  175. }
  176. }
  177. public static GUIStyle LabelStyle {
  178. get {
  179. if (labelStyle == null) {
  180. labelStyle = new GUIStyle(EditorStyles.label);
  181. labelStyle.fontSize = 12;
  182. labelStyle.clipping = TextClipping.Clip;
  183. labelStyle.wordWrap = true;
  184. }
  185. return labelStyle;
  186. }
  187. }
  188. public static GUIStyle BoxStyle {
  189. get {
  190. if (boxStyle == null) {
  191. boxStyle = new GUIStyle(EditorStyles.helpBox);
  192. boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
  193. boxStyle.fontStyle = FontStyle.Bold;
  194. boxStyle.alignment = TextAnchor.UpperLeft;
  195. }
  196. if (!IsDarkMode) {
  197. boxStyle.normal.background = Texture2D.blackTexture;
  198. }
  199. return boxStyle;
  200. }
  201. }
  202. public static GUIStyle WrapStyle {
  203. get {
  204. if (wrapStyle == null) {
  205. wrapStyle = new GUIStyle(EditorStyles.label);
  206. wrapStyle.fontStyle = FontStyle.Normal;
  207. wrapStyle.wordWrap = true;
  208. }
  209. return wrapStyle;
  210. }
  211. }
  212. public static GUIStyle NoPaddingMiddleLeftStyle {
  213. get {
  214. if (noPaddingMiddleLeftStyle == null) {
  215. noPaddingMiddleLeftStyle = new GUIStyle(EditorStyles.label);
  216. noPaddingMiddleLeftStyle.normal.textColor = GUI.skin.label.normal.textColor;
  217. noPaddingMiddleLeftStyle.padding = new RectOffset();
  218. noPaddingMiddleLeftStyle.margin = new RectOffset();
  219. noPaddingMiddleLeftStyle.alignment = TextAnchor.MiddleLeft;
  220. }
  221. return noPaddingMiddleLeftStyle;
  222. }
  223. }
  224. public static GUIStyle MiddleLeftStyle {
  225. get {
  226. if (middleLeftStyle == null) {
  227. middleLeftStyle = new GUIStyle(EditorStyles.label);
  228. middleLeftStyle.fontStyle = FontStyle.Normal;
  229. middleLeftStyle.alignment = TextAnchor.MiddleLeft;
  230. }
  231. return middleLeftStyle;
  232. }
  233. }
  234. public static GUIStyle MiddleCenterStyle {
  235. get {
  236. if (middleCenterStyle == null) {
  237. middleCenterStyle = new GUIStyle(EditorStyles.label);
  238. middleCenterStyle.fontStyle = FontStyle.Normal;
  239. middleCenterStyle.alignment = TextAnchor.MiddleCenter;
  240. }
  241. return middleCenterStyle;
  242. }
  243. }
  244. public static GUIStyle MediumMiddleCenterStyle {
  245. get {
  246. if (mediumMiddleCenterStyle == null) {
  247. mediumMiddleCenterStyle = new GUIStyle(EditorStyles.label);
  248. mediumMiddleCenterStyle.fontStyle = FontStyle.Normal;
  249. mediumMiddleCenterStyle.fontSize = 12;
  250. mediumMiddleCenterStyle.alignment = TextAnchor.MiddleCenter;
  251. }
  252. return mediumMiddleCenterStyle;
  253. }
  254. }
  255. public static GUIStyle TextFieldWrapStyle {
  256. get {
  257. if (textFieldWrapStyle == null) {
  258. textFieldWrapStyle = new GUIStyle(EditorStyles.textField);
  259. textFieldWrapStyle.wordWrap = true;
  260. }
  261. return textFieldWrapStyle;
  262. }
  263. }
  264. public static GUIStyle FoldoutStyle {
  265. get {
  266. if (foldoutStyle == null) {
  267. foldoutStyle = new GUIStyle(EditorStyles.foldout);
  268. foldoutStyle.normal.textColor = GUI.skin.label.normal.textColor;
  269. foldoutStyle.alignment = TextAnchor.MiddleLeft;
  270. foldoutStyle.fontStyle = FontStyle.Bold;
  271. foldoutStyle.fontSize = 12;
  272. }
  273. return foldoutStyle;
  274. }
  275. }
  276. public static GUIStyle LogoStyle {
  277. get {
  278. if (logoStyle == null) {
  279. logoStyle = new GUIStyle();
  280. logoStyle.margin = new RectOffset(6, 6, 0, 0);
  281. logoStyle.padding = new RectOffset(16, 16, 0, 0);
  282. }
  283. return logoStyle;
  284. }
  285. }
  286. public static GUIStyle ChangelogPointerStyle {
  287. get {
  288. if (changelogPointersStyle == null) {
  289. changelogPointersStyle = new GUIStyle(EditorStyles.label);
  290. changelogPointersStyle.wordWrap = true;
  291. changelogPointersStyle.fontSize = 12;
  292. changelogPointersStyle.padding.left = 20;
  293. }
  294. return changelogPointersStyle;
  295. }
  296. }
  297. public static GUIStyle IndicationIcon {
  298. get {
  299. if (indicationIconStyle == null) {
  300. indicationIconStyle = new GUIStyle(H2TitleStyle);
  301. indicationIconStyle.fixedHeight = 20;
  302. }
  303. indicationIconStyle.padding = new RectOffset(left: windowScreenWidth > Constants.IndicationTextHideWidth ? 7 : 5, right: windowScreenWidth > Constants.IndicationTextHideWidth ? 0 : -10, top: 1, bottom: 1);
  304. return indicationIconStyle;
  305. }
  306. }
  307. public static GUIStyle IndicationAlertIcon {
  308. get {
  309. if (indicationAlertIconStyle == null) {
  310. indicationAlertIconStyle = new GUIStyle(H2TitleStyle);
  311. indicationAlertIconStyle.padding = new RectOffset(left: 5, right: -7, top: 1, bottom: 1);
  312. indicationAlertIconStyle.fixedHeight = 20;
  313. }
  314. return indicationAlertIconStyle;
  315. }
  316. }
  317. public static GUIStyle RecompileButton {
  318. get {
  319. if (recompileButtonStyle == null) {
  320. recompileButtonStyle = new GUIStyle(EditorStyles.miniButton);
  321. recompileButtonStyle.margin.top = 17;
  322. recompileButtonStyle.fixedHeight = 25;
  323. recompileButtonStyle.margin.right = 5;
  324. }
  325. recompileButtonStyle.fixedWidth = windowScreenWidth > Constants.RecompileButtonTextHideWidth ? 95 : 30;
  326. return recompileButtonStyle;
  327. }
  328. }
  329. public static GUIStyle StartButton {
  330. get {
  331. if (startButtonStyle == null) {
  332. startButtonStyle = new GUIStyle(EditorStyles.miniButton);
  333. startButtonStyle.fixedHeight = 25;
  334. startButtonStyle.padding.top = 6;
  335. startButtonStyle.padding.bottom = 6;
  336. startButtonStyle.margin.top = 17;
  337. }
  338. startButtonStyle.fixedWidth = windowScreenWidth > Constants.StartButtonTextHideWidth ? 70 : 30;
  339. return startButtonStyle;
  340. }
  341. }
  342. public static GUIStyle StopButton {
  343. get {
  344. if (stopButtonStyle == null) {
  345. stopButtonStyle = new GUIStyle(EditorStyles.miniButton);
  346. stopButtonStyle.fixedHeight = 25;
  347. stopButtonStyle.margin.top = 17;
  348. }
  349. stopButtonStyle.fixedWidth = HotReloadWindowStyles.windowScreenWidth > Constants.StartButtonTextHideWidth ? 70 : 30;
  350. return stopButtonStyle;
  351. }
  352. }
  353. internal static GUIStyle EventFiltersStyle {
  354. get {
  355. if (eventFilters == null) {
  356. eventFilters = new GUIStyle(EditorStyles.toolbarButton);
  357. eventFilters.fontSize = 13;
  358. // gets overwritten to content size
  359. eventFilters.fixedHeight = 26;
  360. eventFilters.fixedWidth = 50;
  361. eventFilters.margin = new RectOffset(0, 0, 0, 0);
  362. eventFilters.padding = new RectOffset(0, 0, 6, 6);
  363. }
  364. return eventFilters;
  365. }
  366. }
  367. private static Texture2D _clearBackground;
  368. private static Texture2D clearBackground {
  369. get {
  370. if (_clearBackground == null) {
  371. _clearBackground = new Texture2D(1, 1);
  372. _clearBackground.SetPixel(0, 0, Color.clear);
  373. _clearBackground.Apply();
  374. }
  375. return _clearBackground;
  376. }
  377. }
  378. public static GUIStyle SectionOuterBoxCompact {
  379. get {
  380. if (sectionOuterBoxCompactStyle == null) {
  381. sectionOuterBoxCompactStyle = new GUIStyle();
  382. sectionOuterBoxCompactStyle.padding.top = 10;
  383. sectionOuterBoxCompactStyle.padding.bottom = 10;
  384. }
  385. // Looks better without a background
  386. sectionOuterBoxCompactStyle.normal.background = clearBackground;
  387. return sectionOuterBoxCompactStyle;
  388. }
  389. }
  390. public static GUIStyle SectionInnerBox {
  391. get {
  392. if (sectionInnerBoxStyle == null) {
  393. sectionInnerBoxStyle = new GUIStyle();
  394. }
  395. sectionInnerBoxStyle.padding = new RectOffset(left: 0, right: 0, top: 15, bottom: 0);
  396. return sectionInnerBoxStyle;
  397. }
  398. }
  399. public static GUIStyle SectionInnerBoxWide {
  400. get {
  401. if (sectionInnerBoxWideStyle == null) {
  402. sectionInnerBoxWideStyle = new GUIStyle(EditorStyles.helpBox);
  403. sectionInnerBoxWideStyle.padding.top = 15;
  404. sectionInnerBoxWideStyle.padding.bottom = 15;
  405. sectionInnerBoxWideStyle.padding.left = 10;
  406. sectionInnerBoxWideStyle.padding.right = 10;
  407. }
  408. return sectionInnerBoxWideStyle;
  409. }
  410. }
  411. public static GUIStyle DynamiSection {
  412. get {
  413. if (dynamicSection == null) {
  414. dynamicSection = new GUIStyle();
  415. }
  416. var defaultPadding = 13;
  417. if (windowScreenWidth > 600) {
  418. var dynamicPadding = (windowScreenWidth - 600) / 2;
  419. dynamicSection.padding.left = defaultPadding + dynamicPadding;
  420. dynamicSection.padding.right = defaultPadding + dynamicPadding;
  421. } else if (windowScreenWidth < Constants.IndicationTextHideWidth) {
  422. dynamicSection.padding.left = 0;
  423. dynamicSection.padding.right = 0;
  424. } else {
  425. dynamicSection.padding.left = 13;
  426. dynamicSection.padding.right = 13;
  427. }
  428. return dynamicSection;
  429. }
  430. }
  431. public static GUIStyle DynamicSectionHelpTab {
  432. get {
  433. if (dynamicSectionHelpTab == null) {
  434. dynamicSectionHelpTab = new GUIStyle(DynamiSection);
  435. }
  436. dynamicSectionHelpTab.padding.left = DynamiSection.padding.left - 3;
  437. dynamicSectionHelpTab.padding.right = DynamiSection.padding.right - 3;
  438. return dynamicSectionHelpTab;
  439. }
  440. }
  441. public static GUIStyle ChangelogSectionInnerBox {
  442. get {
  443. if (changelogSectionInnerBoxStyle == null) {
  444. changelogSectionInnerBoxStyle = new GUIStyle(EditorStyles.helpBox);
  445. changelogSectionInnerBoxStyle.margin.bottom = 10;
  446. changelogSectionInnerBoxStyle.margin.top = 10;
  447. }
  448. return changelogSectionInnerBoxStyle;
  449. }
  450. }
  451. public static GUIStyle IndicationBox {
  452. get {
  453. if (indicationBoxStyle == null) {
  454. indicationBoxStyle = new GUIStyle();
  455. }
  456. indicationBoxStyle.margin.bottom = windowScreenWidth < 141 ? 0 : 10;
  457. return indicationBoxStyle;
  458. }
  459. }
  460. public static GUIStyle LinkStyle {
  461. get {
  462. if (linkStyle == null) {
  463. linkStyle = new GUIStyle(EditorStyles.label);
  464. linkStyle.fontStyle = FontStyle.Bold;
  465. }
  466. var color = IsDarkMode ? DarkModeLinkColor : LightModeModeLinkColor;
  467. linkStyle.normal.textColor = color;
  468. return linkStyle;
  469. }
  470. }
  471. private static Color32 DarkModeLinkColor {
  472. get {
  473. if (darkModeLinkColor == null) {
  474. darkModeLinkColor = new Color32(0x3F, 0x9F, 0xFF, 0xFF);
  475. }
  476. return darkModeLinkColor.Value;
  477. }
  478. }
  479. private static Color32 LightModeModeLinkColor {
  480. get {
  481. if (lightModeModeLinkColor == null) {
  482. lightModeModeLinkColor = new Color32(0x0F, 0x52, 0xD7, 0xFF);
  483. }
  484. return lightModeModeLinkColor.Value;
  485. }
  486. }
  487. public static GUIStyle ProgressBarBarStyle {
  488. get {
  489. if (progressBarBarStyle != null) {
  490. return progressBarBarStyle;
  491. }
  492. var styles = (EditorStyles)typeof(EditorStyles)
  493. .GetField("s_Current", BindingFlags.Static | BindingFlags.NonPublic)
  494. ?.GetValue(null);
  495. var style = styles?.GetType()
  496. .GetField("m_ProgressBarBar", BindingFlags.NonPublic | BindingFlags.Instance)
  497. ?.GetValue(styles);
  498. progressBarBarStyle = style != null ? (GUIStyle)style : GUIStyle.none;
  499. return progressBarBarStyle;
  500. }
  501. }
  502. internal static GUIStyle Section {
  503. get {
  504. if (section == null) {
  505. section = new GUIStyle(EditorStyles.helpBox);
  506. section.padding = new RectOffset(left: 10, right: 10, top: 10, bottom: 10);
  507. section.margin = new RectOffset(left: 0, right: 0, top: 0, bottom: 0);
  508. }
  509. return section;
  510. }
  511. }
  512. internal static GUIStyle Scroll {
  513. get {
  514. if (scroll == null) {
  515. scroll = new GUIStyle(EditorStyles.helpBox);
  516. }
  517. if (IsDarkMode) {
  518. scroll.normal.background = GUIHelper.ConvertTextureToColor(new Color(0,0,0,0.05f));
  519. } else {
  520. scroll.normal.background = GUIHelper.ConvertTextureToColor(new Color(0,0,0,0.03f));
  521. }
  522. return scroll;
  523. }
  524. }
  525. internal static GUIStyle BarStyle {
  526. get {
  527. if (barStyle == null) {
  528. barStyle = new GUIStyle(GUI.skin.label);
  529. barStyle.fontSize = 12;
  530. barStyle.alignment = TextAnchor.MiddleLeft;
  531. barStyle.fixedHeight = 20;
  532. barStyle.padding = new RectOffset(10, 5, 2, 2);
  533. }
  534. return barStyle;
  535. }
  536. }
  537. internal static GUIStyle BarBackgroundStyle {
  538. get {
  539. if (barBgStyle == null) {
  540. barBgStyle = new GUIStyle();
  541. }
  542. barBgStyle.normal.background = GUIHelper.ConvertTextureToColor(Color.clear);
  543. barBgStyle.hover.background = GUIHelper.ConvertTextureToColor(new Color(0, 0, 0, 0.1f));
  544. barBgStyle.focused.background = GUIHelper.ConvertTextureToColor(Color.clear);
  545. barBgStyle.active.background = null;
  546. return barBgStyle;
  547. }
  548. }
  549. internal static GUIStyle ChildBarStyle {
  550. get {
  551. if (barChildStyle == null) {
  552. barChildStyle = new GUIStyle(BarStyle);
  553. barChildStyle.padding = new RectOffset(43, barChildStyle.padding.right, barChildStyle.padding.top, barChildStyle.padding.bottom);
  554. }
  555. return barChildStyle;
  556. }
  557. }
  558. internal static GUIStyle FoldoutBarStyle {
  559. get {
  560. if (barFoldoutStyle == null) {
  561. barFoldoutStyle = new GUIStyle(BarStyle);
  562. barFoldoutStyle.padding = new RectOffset(23, barFoldoutStyle.padding.right, barFoldoutStyle.padding.top, barFoldoutStyle.padding.bottom);
  563. }
  564. return barFoldoutStyle;
  565. }
  566. }
  567. public static GUIStyle TimestampStyle {
  568. get {
  569. if (timestampStyle == null) {
  570. timestampStyle = new GUIStyle(GUI.skin.label);
  571. }
  572. if (IsDarkMode) {
  573. timestampStyle.normal.textColor = new Color(0.5f, 0.5f, 0.5f);
  574. } else {
  575. timestampStyle.normal.textColor = new Color(0.5f, 0.5f, 0.5f);
  576. }
  577. timestampStyle.hover = timestampStyle.normal;
  578. return timestampStyle;
  579. }
  580. }
  581. internal static GUIStyle ClickableLabelBoldStyle {
  582. get {
  583. if (clickableLabelBoldStyle == null) {
  584. clickableLabelBoldStyle = new GUIStyle(LabelStyle);
  585. clickableLabelBoldStyle.fontStyle = FontStyle.Bold;
  586. clickableLabelBoldStyle.fontSize = 14;
  587. clickableLabelBoldStyle.margin.left = 17;
  588. clickableLabelBoldStyle.active.textColor = clickableLabelBoldStyle.normal.textColor;
  589. }
  590. return clickableLabelBoldStyle;
  591. }
  592. }
  593. internal static GUIStyle EmptyListText {
  594. get {
  595. if (_emptyListText == null) {
  596. _emptyListText = new GUIStyle();
  597. _emptyListText.fontSize = 11;
  598. _emptyListText.padding.left = 15;
  599. _emptyListText.padding.top = 10;
  600. _emptyListText.alignment = TextAnchor.MiddleCenter;
  601. _emptyListText.normal.textColor = Color.gray;
  602. }
  603. return _emptyListText;
  604. }
  605. }
  606. internal static GUIStyle StacktraceTextAreaStyle {
  607. get {
  608. if (_stacktraceTextAreaStyle == null) {
  609. _stacktraceTextAreaStyle = new GUIStyle(EditorStyles.textArea);
  610. _stacktraceTextAreaStyle.border = new RectOffset(0, 0, 0, 0);
  611. }
  612. return _stacktraceTextAreaStyle;
  613. }
  614. }
  615. internal static GUIStyle EntryBoxStyle {
  616. get {
  617. if (_entryBoxStyle == null) {
  618. _entryBoxStyle = new GUIStyle();
  619. _entryBoxStyle.margin.left = 30;
  620. }
  621. return _entryBoxStyle;
  622. }
  623. }
  624. internal static GUIStyle ChildEntryBoxStyle {
  625. get {
  626. if (_childEntryBoxStyle == null) {
  627. _childEntryBoxStyle = new GUIStyle();
  628. _childEntryBoxStyle.margin.left = 45;
  629. }
  630. return _childEntryBoxStyle;
  631. }
  632. }
  633. internal static GUIStyle CustomFoldoutStyle {
  634. get {
  635. if (_customFoldoutStyle == null) {
  636. _customFoldoutStyle = new GUIStyle(EditorStyles.foldout);
  637. _customFoldoutStyle.margin.top = 4;
  638. _customFoldoutStyle.margin.left = 0;
  639. _customFoldoutStyle.padding.left = 0;
  640. _customFoldoutStyle.fixedWidth = 100;
  641. }
  642. return _customFoldoutStyle;
  643. }
  644. }
  645. internal static GUIStyle RemoveIconStyle {
  646. get {
  647. if (_removeIconStyle == null) {
  648. _removeIconStyle = new GUIStyle();
  649. _removeIconStyle.margin.top = 5;
  650. _removeIconStyle.fixedWidth = 17;
  651. _removeIconStyle.fixedHeight = 17;
  652. }
  653. return _removeIconStyle;
  654. }
  655. }
  656. internal static GUIStyle UpgradeLicenseButtonStyle {
  657. get {
  658. if (upgradeLicenseButtonStyle == null) {
  659. upgradeLicenseButtonStyle = new GUIStyle(GUI.skin.button);
  660. upgradeLicenseButtonStyle.padding = new RectOffset(5, 5, 0, 0);
  661. }
  662. return upgradeLicenseButtonStyle;
  663. }
  664. }
  665. internal static GUIStyle UpgradeLicenseButtonOverlayStyle {
  666. get {
  667. if (upgradeLicenseButtonOverlayStyle == null) {
  668. upgradeLicenseButtonOverlayStyle = new GUIStyle(UpgradeLicenseButtonStyle);
  669. }
  670. return upgradeLicenseButtonOverlayStyle;
  671. }
  672. }
  673. internal static GUIStyle UpgradeButtonStyle {
  674. get {
  675. if (upgradeButtonStyle == null) {
  676. upgradeButtonStyle = new GUIStyle(EditorStyles.miniButton);
  677. upgradeButtonStyle.fontStyle = FontStyle.Bold;
  678. upgradeButtonStyle.fontSize = 14;
  679. upgradeButtonStyle.fixedHeight = 24;
  680. }
  681. return upgradeButtonStyle;
  682. }
  683. }
  684. internal static GUIStyle HideButtonStyle {
  685. get {
  686. if (hideButtonStyle == null) {
  687. hideButtonStyle = new GUIStyle(GUI.skin.button);
  688. }
  689. return hideButtonStyle;
  690. }
  691. }
  692. internal static GUIStyle HelpTabButton {
  693. get {
  694. if (helpTabButton == null) {
  695. helpTabButton = new GUIStyle(GUI.skin.button);
  696. helpTabButton.alignment = TextAnchor.MiddleLeft;
  697. helpTabButton.padding.left = 10;
  698. }
  699. return helpTabButton;
  700. }
  701. }
  702. internal static GUIStyle IndicationHelpBox {
  703. get {
  704. if (indicationHelpBox == null) {
  705. indicationHelpBox = new GUIStyle(EditorStyles.helpBox);
  706. indicationHelpBox.margin.right = 0;
  707. indicationHelpBox.margin.left = 0;
  708. }
  709. return indicationHelpBox;
  710. }
  711. }
  712. }
  713. }