Seven is the number.
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.

92 lines
1.8 KiB

4 years ago
  1. using UnityEngine;
  2. using System.Diagnostics;
  3. #if UNITY_EDITOR
  4. using UnityEditor;
  5. #endif
  6. namespace BoltInternal
  7. {
  8. public class UnityDebugDrawer : IDebugDrawer
  9. {
  10. bool isEditor;
  11. void IDebugDrawer.IsEditor(bool isEditor)
  12. {
  13. this.isEditor = isEditor;
  14. }
  15. void IDebugDrawer.SelectGameObject(GameObject gameObject)
  16. {
  17. #if UNITY_EDITOR
  18. if (!isEditor)
  19. {
  20. Selection.activeGameObject = gameObject;
  21. }
  22. #endif
  23. }
  24. void IDebugDrawer.Indent(int level)
  25. {
  26. #if UNITY_EDITOR
  27. if (isEditor)
  28. {
  29. EditorGUI.indentLevel = level;
  30. return;
  31. }
  32. #endif
  33. }
  34. void IDebugDrawer.Label(string text)
  35. {
  36. #if UNITY_EDITOR
  37. if (isEditor)
  38. {
  39. GUILayout.Label(text);
  40. return;
  41. }
  42. #endif
  43. Bolt.DebugInfo.Label(text);
  44. }
  45. void IDebugDrawer.LabelBold(string text)
  46. {
  47. #if UNITY_EDITOR
  48. if (isEditor)
  49. {
  50. GUILayout.Label(text, EditorStyles.boldLabel);
  51. return;
  52. }
  53. #endif
  54. Bolt.DebugInfo.LabelBold(text);
  55. }
  56. void IDebugDrawer.LabelField(string text, object value)
  57. {
  58. #if UNITY_EDITOR
  59. if (isEditor)
  60. {
  61. EditorGUILayout.LabelField(text, value.ToString());
  62. return;
  63. }
  64. #endif
  65. Bolt.DebugInfo.LabelField(text, value);
  66. }
  67. void IDebugDrawer.Separator()
  68. {
  69. #if UNITY_EDITOR
  70. if (isEditor)
  71. {
  72. EditorGUILayout.Separator();
  73. return;
  74. }
  75. #endif
  76. GUILayout.Space(2);
  77. }
  78. }
  79. }