BugReportTabController.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using SRF.Service;
  2. namespace SRDebugger.UI.Tabs
  3. {
  4. using Services;
  5. using Other;
  6. using SRF;
  7. using UnityEngine;
  8. public class BugReportTabController : SRMonoBehaviourEx, IEnableTab
  9. {
  10. [RequiredField] public BugReportSheetController BugReportSheetPrefab;
  11. [RequiredField] public RectTransform Container;
  12. public bool IsEnabled
  13. {
  14. get { return SRServiceManager.GetService<IBugReportService>().IsUsable; }
  15. }
  16. protected override void Start()
  17. {
  18. base.Start();
  19. var sheet = SRInstantiate.Instantiate(BugReportSheetPrefab);
  20. sheet.IsCancelButtonEnabled = false;
  21. // Callbacks when taking screenshot will hide the debug panel so it is not present in the image
  22. sheet.TakingScreenshot = TakingScreenshot;
  23. sheet.ScreenshotComplete = ScreenshotComplete;
  24. sheet.CachedTransform.SetParent(Container, false);
  25. }
  26. private void TakingScreenshot()
  27. {
  28. SRDebug.Instance.HideDebugPanel();
  29. }
  30. private void ScreenshotComplete()
  31. {
  32. SRDebug.Instance.ShowDebugPanel(false);
  33. }
  34. }
  35. }