IDebugService.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using SRDebugger.Internal;
  2. using UnityEngine;
  3. namespace SRDebugger
  4. {
  5. public delegate void VisibilityChangedDelegate(bool isVisible);
  6. public delegate void ActionCompleteCallback(bool success);
  7. public delegate void PinnedUiCanvasCreated(RectTransform canvasTransform);
  8. }
  9. namespace SRDebugger.Services
  10. {
  11. using UnityEngine;
  12. public interface IDebugService
  13. {
  14. /// <summary>
  15. /// Current settings being used by the debugger
  16. /// </summary>
  17. Settings Settings { get; }
  18. /// <summary>
  19. /// True if the debug panel is currently being shown
  20. /// </summary>
  21. bool IsDebugPanelVisible { get; }
  22. /// <summary>
  23. /// True if the trigger is currently enabled
  24. /// </summary>
  25. bool IsTriggerEnabled { get; set; }
  26. IDockConsoleService DockConsole { get; }
  27. bool IsProfilerDocked { get; set; }
  28. /// <summary>
  29. /// Add <paramref name="entry"/> to the system information tab. See <seealso cref="InfoEntry"/> for how to create
  30. /// an info instance.
  31. /// </summary>
  32. /// <param name="entry">The entry to be added.</param>
  33. /// <param name="category">The category the entry should be added to.</param>
  34. void AddSystemInfo(InfoEntry entry, string category = "Default");
  35. /// <summary>
  36. /// Show the debug panel
  37. /// </summary>
  38. /// <param name="requireEntryCode">
  39. /// If true and entry code is enabled in settings, the user will be prompted for a passcode
  40. /// before opening the panel.
  41. /// </param>
  42. void ShowDebugPanel(bool requireEntryCode = true);
  43. /// <summary>
  44. /// Show the debug panel and open a certain tab
  45. /// </summary>
  46. /// <param name="tab">Tab that will appear when the debug panel is opened</param>
  47. /// <param name="requireEntryCode">
  48. /// If true and entry code is enabled in settings, the user will be prompted for a passcode
  49. /// before opening the panel.
  50. /// </param>
  51. void ShowDebugPanel(DefaultTabs tab, bool requireEntryCode = true);
  52. /// <summary>
  53. /// Hide the debug panel
  54. /// </summary>
  55. void HideDebugPanel();
  56. /// <summary>
  57. /// Hide the debug panel, then remove it from the scene to save memory.
  58. /// </summary>
  59. void DestroyDebugPanel();
  60. /// <summary>
  61. /// Add all an objects compatible properties and methods to the options panel.
  62. /// <remarks>NOTE: It is not recommended to use this on a MonoBehaviour, it should be used on a standard
  63. /// class made specifically for use as a settings object.</remarks>
  64. /// </summary>
  65. /// <param name="container">The object to add.</param>
  66. void AddOptionContainer(object container);
  67. /// <summary>
  68. /// Remove all properties and methods that the <paramref name="container"/> added to the options panel.
  69. /// </summary>
  70. /// <param name="container">The container to remove.</param>
  71. void RemoveOptionContainer(object container);
  72. /// <summary>
  73. /// Add an option to the options panel.
  74. /// </summary>
  75. void AddOption(OptionDefinition option);
  76. /// <summary>
  77. /// Remove an option from the options panel.
  78. /// </summary>
  79. /// <returns>True if option was successfully removed, otherwise false.</returns>
  80. bool RemoveOption(OptionDefinition option);
  81. /// <summary>
  82. /// Pin all options in a category.
  83. /// </summary>
  84. /// <param name="category"></param>
  85. void PinAllOptions(string category);
  86. /// <summary>
  87. /// Unpin all options in a category.
  88. /// </summary>
  89. /// <param name="category"></param>
  90. void UnpinAllOptions(string category);
  91. void PinOption(string name);
  92. void UnpinOption(string name);
  93. /// <summary>
  94. /// Clear all pinned options.
  95. /// </summary>
  96. void ClearPinnedOptions();
  97. /// <summary>
  98. /// Open a bug report sheet.
  99. /// </summary>
  100. /// <param name="onComplete">Callback to invoke once the bug report is completed or cancelled. Null to ignore.</param>
  101. /// <param name="takeScreenshot">
  102. /// Take a screenshot before opening the report sheet (otherwise a screenshot will be taken as
  103. /// the report is sent, if enabled in settings)
  104. /// </param>
  105. /// <param name="descriptionContent">Initial content of the bug report description</param>
  106. void ShowBugReportSheet(ActionCompleteCallback onComplete = null, bool takeScreenshot = true,
  107. string descriptionContent = null);
  108. /// <summary>
  109. /// Event invoked whenever the debug panel opens or closes
  110. /// </summary>
  111. event VisibilityChangedDelegate PanelVisibilityChanged;
  112. event PinnedUiCanvasCreated PinnedUiCanvasCreated;
  113. /// <summary>
  114. /// ADVANCED FEATURE. This will convert the debug panel to a world space object and return the RectTransform.
  115. /// This can be used to position the SRDebugger panel somewhere in your scene.
  116. /// This feature is for advanced users only who know what they are doing. Only limited support will be provided
  117. /// for this method.
  118. /// The debug panel will be made visible if it is not already.
  119. /// </summary>
  120. /// <returns>The debug panel RectTransform.</returns>
  121. RectTransform EnableWorldSpaceMode();
  122. }
  123. }