DebugGuiBase.cs 729 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using UnityEngine;
  3. public abstract class DebugGuiBase : MonoBehaviour
  4. {
  5. private void Start()
  6. {
  7. this._id = UIDebug.Register(this.UIDebugButtonName, new EventDelegate.Callback(this.OpenDebugUI));
  8. DebugGuiHost.Register(this);
  9. this.GUIStart();
  10. }
  11. private void OnDestroy()
  12. {
  13. UIDebug.Unregister(this._id);
  14. DebugGuiHost.Unregister(this);
  15. }
  16. private void OpenDebugUI()
  17. {
  18. this.InVisible = !this.InVisible;
  19. }
  20. protected abstract string UIDebugButtonName { get; }
  21. public abstract void OnDebugGUI();
  22. protected abstract void GUIStart();
  23. [Header("是否开启,可以通过设置该值默认开启")]
  24. [SerializeField]
  25. public bool InVisible;
  26. private int _id;
  27. }