private bool canPreventGesture(Gesture first, Gesture second) { bool result = true; if (GlobalGestureDelegate != null) result = !GlobalGestureDelegate.ShouldRecognizeSimultaneously(first, second); return result && first.CanPreventGesture(second); }
private void recognizeGesture(Gesture gesture) { var gestures = getHierarchyContaining(gesture.transform); foreach (var otherGesture in gestures) { if (gesture == otherGesture) continue; if (!gestureIsActive(otherGesture)) continue; if (!(otherGesture.State == Gesture.GestureState.Began || otherGesture.State == Gesture.GestureState.Changed) && gesture.CanPreventGesture(otherGesture)) { failGesture(otherGesture); } } }
TouchRadius = .75f; } private void failGesture(Gesture gesture) { gesture.SetState(Gesture.GestureState.Failed); } private bool gestureCanRecognize(Gesture gesture) { if (!gesture.ShouldBegin()) return false; var gestures = getHierarchyContaining(gesture.transform); foreach (var otherGesture in gestures) { if (gesture == otherGesture) continue; if (!gestureIsActive(otherGesture)) continue;
private bool recognizeGestureIfNotPrevented(Gesture gesture) { if (!gesture.ShouldBegin()) return false; bool canRecognize = true; List<Gesture> gesturesToFail = new List<Gesture>(10); var gestures = getHierarchyContaining(gesture.transform); foreach (var otherGesture in gestures) { if (gesture == otherGesture) continue; if (!gestureIsActive(otherGesture)) continue; if (otherGesture.State == Gesture.GestureState.Began || otherGesture.State == Gesture.GestureState.Changed) { if (otherGesture.CanPreventGesture(gesture)) { canRecognize = false; break; } } else { if (gesture.CanPreventGesture(otherGesture)) { gesturesToFail.Add(otherGesture); } } } if (canRecognize) { foreach (var otherGesture in gesturesToFail) { failGesture(otherGesture); } } return canRecognize; }
private bool recognizeGestureIfNotPrevented(Gesture gesture) { if (!gesture.ShouldBegin()) return false; var gesturesToFail = gestureListPool.Get(); var gesturesInHierarchy = gestureListPool.Get(); bool canRecognize = true; getHierarchyContaining(gesture.transform, gesturesInHierarchy); var count = gesturesInHierarchy.Count; for (var i = 0; i < count; i++) { var otherGesture = gesturesInHierarchy[i]; if (gesture == otherGesture) continue; if (!gestureIsActive(otherGesture)) continue; if (otherGesture.State == Gesture.GestureState.Began || otherGesture.State == Gesture.GestureState.Changed) { if (otherGesture.CanPreventGesture(gesture)) { canRecognize = false; break; } } else { if (gesture.CanPreventGesture(otherGesture)) { gesturesToFail.Add(otherGesture); } } } if (canRecognize) { count = gesturesToFail.Count; for (var i = 0; i < count; i++) { failGesture(gesturesToFail[i]); } } gestureListPool.Release(gesturesToFail); gestureListPool.Release(gesturesInHierarchy); return canRecognize; }