KeyboardManipulationHandler.cs 954 B

1234567891011121314151617181920212223242526272829
  1. using SC.XR.Unity.Module_InputSystem;
  2. using UnityEngine.EventSystems;
  3. namespace SC.XR.Unity.Module_Keyboard
  4. {
  5. public class KeyboardManipulationHandler : PointerHandler
  6. {
  7. ManipulationHandler manipulationHandler;
  8. public override void OnPointerDown(PointerEventData eventData)
  9. {
  10. base.OnPointerDown(eventData);
  11. manipulationHandler = manipulationHandler==null?gameObject.AddComponent<ManipulationHandler>(): manipulationHandler;
  12. manipulationHandler.enabled = true;
  13. manipulationHandler.OnPointerDown(eventData);
  14. GameKey2Dboard gameKey2Dboard = this.GetComponentInParent<GameKey2Dboard>();
  15. gameKey2Dboard.OnPointerDown?.Invoke(eventData);
  16. }
  17. public override void OnPointerUp(PointerEventData eventData)
  18. {
  19. base.OnPointerUp(eventData);
  20. manipulationHandler.enabled = false;
  21. }
  22. }
  23. }