ColorPickClick.cs 1010 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using System;
  6. using UnityEngine.UI;
  7. namespace MetaClient
  8. {
  9. public class ColorPickClick : MonoBehaviour, IPointerDownHandler, IDragHandler
  10. {
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. }
  15. public Button.ButtonClickedEvent Click;
  16. public Vector3 ClickPoint { get; set; }
  17. public void OnPointerDown(PointerEventData eventData)
  18. {
  19. var rect = transform as RectTransform;
  20. ClickPoint = rect.InverseTransformPoint(eventData.position);
  21. Click.Invoke();
  22. }
  23. public void OnDrag(PointerEventData eventData)
  24. {
  25. var rect = transform as RectTransform;
  26. ClickPoint = rect.InverseTransformPoint(eventData.position);
  27. Click.Invoke();
  28. }
  29. // Update is called once per frame
  30. void Update()
  31. {
  32. }
  33. }
  34. }