SCSlider2D.cs 969 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.Events;
  6. using UnityEngine.EventSystems;
  7. using UnityEngine.UI;
  8. namespace SC.XR.Unity
  9. {
  10. public class SCSlider2D : Slider
  11. {
  12. [SerializeField]
  13. public SliderEvent m_OnDrag;
  14. [SerializeField]
  15. public SliderEvent m_OnPointerDown;
  16. [SerializeField]
  17. public SliderEvent m_OnPointerUp;
  18. public override void OnPointerDown(PointerEventData eventData)
  19. {
  20. base.OnPointerDown(eventData);
  21. m_OnPointerDown?.Invoke(value);
  22. }
  23. public override void OnPointerUp(PointerEventData eventData)
  24. {
  25. base.OnPointerUp(eventData);
  26. m_OnPointerUp?.Invoke(value);
  27. }
  28. public override void OnDrag(PointerEventData eventData)
  29. {
  30. base.OnDrag(eventData);
  31. m_OnDrag?.Invoke(value);
  32. }
  33. }
  34. }