Exemplo n.º 1
0
        private async Task HandleLongPress()
        {
            // Only execute long press detection if there are listeners registered:
            if (onLongPressStart.IsNullOrEmpty() && onLongPressEnd.IsNullOrEmpty())
            {
                return;
            }

            var isPointerUpAgain = pointerUpTask.Task;
            await TaskV2.Delay(longPressDurInMs);

            var distanceInPixels = latestPointer.position - pointerDown.position;

            if (distanceInPixels.magnitude > maxPixelDistance)
            {
                return;
            }

            if (!isPointerUpAgain.IsCompleted)
            {
                SetClickResult(ClickResult.longPress);
                onLongPressStart?.Invoke();
                await pointerUpTask.Task;
                onLongPressEnd?.Invoke();
            }
        }
Exemplo n.º 2
0
 public static bool IsNullOrEmpty(this UnityEvent self, int target) => self.IsNullOrEmpty() || self.GetPersistentTarget(target) == null || self.GetPersistentMethodName(target).IsNullOrEmpty();
Exemplo n.º 3
0
 public static bool IsNullOrEmpty(this UnityEvent self, int target)
 {
     return(self.IsNullOrEmpty() || Object.op_Equality(((UnityEventBase)self).GetPersistentTarget(target), (Object)null) || ((UnityEventBase)self).GetPersistentMethodName(target).IsNullOrEmpty());
 }