123456789101112131415161718192021222324252627282930313233343536373839404142 |
- //==========================================================
- //
- // Copyright (c) Guangzhou Shixiang Technology Co.,Ltd.
- // All rights reserved.
- //
- //==========================================================
- using GxrSdk;
- using UnityEngine;
- using UnityEngine.EventSystems;
- public class LockTargetHandle : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler
- {
- [SerializeField]
- private Transform DraggedTarget;
- public void OnPointerDown(PointerEventData eventData)
- {
- }
- public void OnPointerUp(PointerEventData eventData)
- {
- }
- public void OnPointerClick(PointerEventData eventData)
- {
- GxrInputAccessor.RegisterPointerLockOntoCallback(LockCompleted, UnlockCompleted);
- GxrInputAccessor.LockPointerOntoDraggedTarget(DraggedTarget);
- }
- private void LockCompleted()
- {
- Debug.Log($"[LockTargetHandle][LockCompleted]");
- }
- private void UnlockCompleted()
- {
- Debug.Log($"[LockTargetHandle][UnlockCompleted]");
- GxrInputAccessor.UnregisterPointerLockOntoCallback(LockCompleted, UnlockCompleted);
- }
- }
|