PageComponent.cs 964 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using UnityEngine.UIElements;
  2. namespace Unity.Cloud.Collaborate.Components
  3. {
  4. internal abstract class PageComponent : VisualElement
  5. {
  6. /// <summary>
  7. /// Current active status for this page.
  8. /// </summary>
  9. protected bool Active { get; private set; }
  10. /// <summary>
  11. /// Set active status of this page.
  12. /// </summary>
  13. /// <param name="active">True if the page is to be active.</param>
  14. public void SetActive(bool active)
  15. {
  16. Active = active;
  17. if (Active)
  18. {
  19. SetActive();
  20. }
  21. else
  22. {
  23. SetInactive();
  24. }
  25. }
  26. /// <summary>
  27. /// Set this page active.
  28. /// </summary>
  29. protected abstract void SetActive();
  30. /// <summary>
  31. /// Set this page inactive.
  32. /// </summary>
  33. protected abstract void SetInactive();
  34. }
  35. }