DebuggerComponent.OperationsWindow.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 loyalsoft. All rights reserved.
  4. // Homepage: http://www.game7000.com/
  5. // Feedback: http://www.game7000.com/
  6. //------------------------------------------------------------
  7. using UnityEngine;
  8. namespace UnityGameFramework.Runtime
  9. {
  10. public sealed partial class DebuggerComponent : GameFrameworkComponent
  11. {
  12. private sealed class OperationsWindow : ScrollableDebuggerWindowBase
  13. {
  14. protected override void OnDrawScrollableWindow()
  15. {
  16. GUILayout.Label("<b>Operations</b>");
  17. GUILayout.BeginVertical("box");
  18. {
  19. ObjectPoolComponent objectPoolComponent = GameEntry.GetComponent<ObjectPoolComponent>();
  20. if (objectPoolComponent != null)
  21. {
  22. if (GUILayout.Button("Object Pool Release", GUILayout.Height(30f)))
  23. {
  24. objectPoolComponent.Release();
  25. }
  26. if (GUILayout.Button("Object Pool Release All Unused", GUILayout.Height(30f)))
  27. {
  28. objectPoolComponent.ReleaseAllUnused();
  29. }
  30. }
  31. ResourceComponent resourceCompoent = GameEntry.GetComponent<ResourceComponent>();
  32. if (resourceCompoent != null)
  33. {
  34. if (GUILayout.Button("Unload Unused Assets", GUILayout.Height(30f)))
  35. {
  36. resourceCompoent.ForceUnloadUnusedAssets(false);
  37. }
  38. if (GUILayout.Button("Unload Unused Assets and Garbage Collect", GUILayout.Height(30f)))
  39. {
  40. resourceCompoent.ForceUnloadUnusedAssets(true);
  41. }
  42. }
  43. if (GUILayout.Button("Shutdown Game Framework (None)", GUILayout.Height(30f)))
  44. {
  45. GameEntry.Shutdown(ShutdownType.None);
  46. }
  47. if (GUILayout.Button("Shutdown Game Framework (Restart)", GUILayout.Height(30f)))
  48. {
  49. GameEntry.Shutdown(ShutdownType.Restart);
  50. }
  51. if (GUILayout.Button("Shutdown Game Framework (Quit)", GUILayout.Height(30f)))
  52. {
  53. GameEntry.Shutdown(ShutdownType.Quit);
  54. }
  55. }
  56. GUILayout.EndVertical();
  57. }
  58. }
  59. }
  60. }