private async void onTouchAction(ITouch touch, TouchMotionAction action) { if (_FirstTouch == null && action == TouchMotionAction.Down) { _FirstTouch = touch; previousTouchPos = touch.Position; } if (touch != _FirstTouch) { return; } if (action == TouchMotionAction.Move) { Vector2 speed = (touch.Position - previousTouchPos) * _SpeedFactor; previousTouchPos = touch.Position; IConnectionManager controllerManager = DependencyService.Get <IConnectionManager>(); IConnection connection = controllerManager.ControllerConnection; if (connection != null && connection.ConnectionEstablishState == ConnectionEstablishState.Succeeded) { RemoteXControlMessage data = new RemoteXControlMessage((int)DataType.TouchMouseSpeed, new float[] { speed.x, speed.y }); await connection.SendAsync(data.Bytes); } } else if (action == TouchMotionAction.Up) { if (touch == _FirstTouch) { _FirstTouch = null; } } }
/// <summary> /// Checks if wire touch connects with another wire. /// </summary> private void CheckConnectWithWire() { if (m_wireTouch == null) { return; } // Check if touch that selected this wire connects with another wire on the opposite side of the screen RaycastHit2D[] hits = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(m_wireTouch.Position), Vector2.zero); foreach (RaycastHit2D hit in hits) { if (hit.transform == null) { continue; } // Skip checking this wire if (hit.transform == this.transform) { continue; } Wire otherWire = hit.transform.GetComponent <Wire>(); if (otherWire == null) { continue; } // If other wire is the same type as this wire, connect the two if (otherWire.GetWireType() == m_wireType) { SetConnected(); otherWire.SetConnected(); // Play plug-in sound Locator.GetSoundSystem().PlayOneShot(SoundInfo.SFXID.WIRE_PLUGIN); ResetConnectGuide(); m_sceneMaster.NotifyWireConnect(this, otherWire); } // Else, game over else { // Play zap sound Locator.GetSoundSystem().PlayOneShot(SoundInfo.SFXID.WIRE_ZAP); // Replace connect guide with electric bolt ReplaceGuideWithBolt(); m_sceneMaster.NotifyWireMismatch(); } m_wireTouch = null; // Stop connect sound m_connectSound.Stop(); break; } }
protected override void ProcessOneTouch(ITouch touch) { switch (touch.phase) { case TouchPhase.Began: currentGesture = processGesture(touch, currentGesture); break; case TouchPhase.Ended: case TouchPhase.Canceled: currentGesture = new CustomizerGestureModel(); break; case TouchPhase.Moved: switch (currentGesture.TouchDownStartArea) { case AreaTouchedEnum.INVENTORY_BUTTON: if (checkButtonDrag(touch.deltaPosition) && currentGesture.IsEquippable) { InventoryContext.EventBus.DispatchEvent(new InventoryDragEvents.DragInventoryButton(currentGesture)); } break; case AreaTouchedEnum.PENGUIN_PREVIEW_ROTATION_AREA: InventoryContext.EventBus.DispatchEvent(new InventoryDragEvents.RotatePenguinPreview(currentGesture)); break; } break; case TouchPhase.Stationary: break; } }
private PointerEventData GetTouchScriptPointerEventData(ITouch input, out bool pressed, out bool released) { PointerEventData pointerData; bool created = GetPointerData(input.Id, out pointerData, true); pointerData.Reset(); // are tags the way to go here? pressed = created || beganDummieIDs.Contains(input.Id); released = endedDummieIDs.Contains(input.Id); if (created) { pointerData.position = input.Position; } if (pressed) { pointerData.delta = Vector2.zero; } else { pointerData.delta = input.Position - pointerData.position; } //use input.PreviousPosition instead of pointerData.position? pointerData.position = input.Position; pointerData.button = PointerEventData.InputButton.Left; eventSystem.RaycastAll(pointerData, m_RaycastResultCache); var raycast = FindFirstRaycast(m_RaycastResultCache); pointerData.pointerCurrentRaycast = raycast; m_RaycastResultCache.Clear(); return(pointerData); }
private CustomizerGestureModel processGesture(ITouch touch, CustomizerGestureModel gestureModel) { gestureModel.TouchDownStartPos = touch.position; if (isOverUI(touch)) { if (EventSystem.current.currentSelectedGameObject != null) { EquipmentIcon component = EventSystem.current.currentSelectedGameObject.GetComponent <EquipmentIcon>(); if (component != null) { gestureModel.TouchDownStartArea = AreaTouchedEnum.INVENTORY_BUTTON; gestureModel.DragIconTexture = component.GetIcon() as Texture2D; gestureModel.ItemId = component.EquipmentId; gestureModel.IsEquippable = component.IsEquippable; } } } else if (isTouchBlockedByUIControls(touch)) { gestureModel.TouchDownStartArea = AreaTouchedEnum.CLICK_BLOCKING_UI; } else { gestureModel.TouchDownStartArea = AreaTouchedEnum.PENGUIN_PREVIEW_ROTATION_AREA; } return(gestureModel); }
private void InputTouchMoved(ITouch point) { if (TouchMoved != null) { TouchMoved(new TouchInfo(GetTouchPosition(point.Position), null)); } }
/// <summary> /// Raises the wire press event. /// </summary> private void OnWirePress(object sender, System.EventArgs e) { // Process only one touch per wire if (m_isGuideActive) { return; } m_isGuideActive = true; // Lazy init if (m_connectGuide == null) { m_connectGuide = CreateConnectGuide(); } // Play connect sound if (m_connectSound == null) { m_connectSound = Locator.GetSoundSystem().PlaySound(SoundInfo.SFXID.WIRE_CONNECT); } else { m_connectSound.Play(); } // Find and store a reference to the touch foreach (ITouch touch in m_pressGesture.ActiveTouches) { if (m_pressGesture.HasTouch(touch)) { m_wireTouch = touch; break; } } }
private void DestroyTool(ITouch touch) { if (_touchIDToolMap.ContainsKey(touch.Id)) { GameObject.Destroy(_touchIDToolMap[touch.Id]); _touchIDToolMap.Remove(touch.Id); } }
/// <inheritdoc /> public override bool ShouldReceiveTouch(ITouch touch) { if (!IgnoreChildren) return base.ShouldReceiveTouch(touch); if (!base.ShouldReceiveTouch(touch)) return false; if (touch.Target != cachedTransform) return false; return true; }
private void InputTouchEnded(ITouch point) { if (TouchUpClicked != null) { var touchPosition = GetTouchPosition(point.Position); TouchUpClicked(new TouchInfo(touchPosition, GetRaycastHitByCamera(touchPosition).transform)); } }
public static bool isTouchInsideRect(Rect position) { ITouch iTouch = ServiceLocator.getITouch(); Rect acc = new Rect(getClipRect().position + position.position, position.size); return(acc.Contains(iTouch.getTouchPosition())); }
protected override LayerHitResult beginTouch(ITouch touch, out ITouchHit hit) { hit = null; if (enabled == false || gameObject.activeInHierarchy == false) return LayerHitResult.Miss; var result = movie.BeginTouch(touch.Id, touch.Position.x, touch.Position.y); return (LayerHitResult)result; }
public bool ShouldReceiveTouch(Gesture gesture, ITouch touch) { if (touch.Tags.HasTag("Mouse")) { return(false); } return(true); }
private void DestroyTool(ITouch touch) { if (_touchIDToolMap.ContainsKey(touch.Id)) { GameObject.Destroy(_touchIDToolMap[touch.Id]); _touchIDToolMap.Remove(touch.Id); } }
/// <summary> /// Specifies if gesture can receive this specific touch point. /// </summary> /// <param name="touch">The touch.</param> /// <returns><c>true</c> if this touch should be received by the gesture; otherwise, <c>false</c>.</returns> public virtual bool ShouldReceiveTouch(ITouch touch) { if (Delegate == null) { return(true); } return(Delegate.ShouldReceiveTouch(this, touch)); }
/// <inheritdoc /> public bool Equals(ITouch other) { if (other == null) { return(false); } return(Id == other.Id); }
/// <summary> /// Raises the release event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> protected void OnObjectRelease(object sender, System.EventArgs e) { if (m_unpressedSprite != null) { m_spriteRenderer.sprite = m_unpressedSprite; } m_activeTouch = null; m_isPressed = false; }
private void onDragEnd(ITouch touch) { dragContainer.Hide(); if (touch.position.y > (float)Screen.height * mainCamera.rect.y) { CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.SelectTemplate(templateData, dragContainer.GetSprite())); } CustomizationContext.EventBus.DispatchEvent(default(CustomizerDragEvents.GestureComplete)); }
private void updateObjectProperties(ITouch touch, TuioObject obj) { var props = touch.Properties; props["Angle"] = obj.Angle; props["ObjectId"] = obj.ClassId; props["RotationVelocity"] = obj.RotationVelocity; props["RotationAcceleration"] = obj.RotationAcceleration; }
/// <summary>Removes a point from cluster.</summary> /// <param name="point">A point.</param> public void RemovePoint(ITouch point) { if (!points.Contains(point)) { return; } points.Remove(point); markDirty(); }
/// <summary>Adds a point to cluster.</summary> /// <param name="point">A point.</param> public void AddPoint(ITouch point) { if (points.Contains(point)) { return; } points.Add(point); markDirty(); }
public static ITouch fromTouch(Touch touch) { ITouch result = default(ITouch); result.phase = touch.phase; result.position = touch.position; result.deltaPosition = touch.deltaPosition; result.tapCount = touch.tapCount; return(result); }
public DoubleFlick(ITouch touch1, ITouch touch2) : base(2) { this.gestureTouches.Add(touch1); this.gestureTouches.Add(touch2); if (touch1.SystemTouch.State == TouchLocationState.Released) Direction = touch1.Positions.Delta; else Direction = touch2.Positions.Delta; }
private void InputTouchBegin(ITouch point) { var touchPosition = GetTouchPosition(point.Position); var raycastHitByCamera = GetRaycastHitByCamera(touchPosition); if (TouchDownClicked != null /*&& raycastHitByCamera.transform != null*/) { TouchDownClicked(new TouchInfo(touchPosition, raycastHitByCamera.transform)); } }
public void touchEnd(ITouch touch) { ITouch dummy; if (!dummies.TryGetValue(touch.Id, out dummy)) return; dummies.Remove(touch.Id); GameObject testBox; if (!boxes.TryGetValue(touch.Id, out testBox)) return; Destroy (boxes[touch.Id]); boxes.Remove(touch.Id); }
public ITouch GetTouch(int touchIndex) { ITouch retVal = null; if (_gameEngineInterface.Input.TouchCount > touchIndex) { retVal = _gameEngineInterface.Input.GetTouch(touchIndex); } return(retVal); }
private void updateBlobProperties(ITouch touch, TuioBlob blob) { var props = touch.Properties; props["Angle"] = blob.Angle; props["Width"] = blob.Width; props["Height"] = blob.Height; props["Area"] = blob.Area; props["RotationVelocity"] = blob.RotationVelocity; props["RotationAcceleration"] = blob.RotationAcceleration; }
public void AddOne(ITouch touch) { if (!caliPoints.ContainsKey(touch.Id)) { var position = GetComponent<Camera> ().ScreenToWorldPoint (new Vector3 (touch.Position.x, touch.Position.y, 1)); var newTouch = Instantiate (indicator, position, Quaternion.identity) as GameObject; newTouch.name = "Indicator"; newTouch.tag = "Cali"; caliPoints.Add (touch.Id, newTouch); } }
protected void processBegan(ITouch touch) { PointerEventData pointerEvent; getPointerData(touch.Id, out pointerEvent, true); pointerEvent.position = touch.Position; pointerEvent.button = PointerEventData.InputButton.Left; pointerEvent.eligibleForClick = true; pointerEvent.delta = Vector2.zero; pointerEvent.dragging = false; pointerEvent.useDragThreshold = true; pointerEvent.pressPosition = pointerEvent.position; raycastPointer(pointerEvent); pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast; var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject; deselectIfSelectionChanged(currentOverGo, pointerEvent); if (pointerEvent.pointerEnter != currentOverGo) { // send a pointer enter to the touched element if it isn't the one to select... HandlePointerExitAndEnter(pointerEvent, currentOverGo); pointerEvent.pointerEnter = currentOverGo; } // search for the control that will receive the press // if we can't find a press handler set the press // handler to be what would receive a click. var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler); // didnt find a press handler... search for a click handler if (newPressed == null) { newPressed = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo); } // TODO: double-tap pointerEvent.clickCount = 1; pointerEvent.pointerPress = newPressed; pointerEvent.rawPointerPress = currentOverGo; pointerEvent.clickTime = Time.unscaledTime; // Save the drag handler as well pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler>(currentOverGo); if (pointerEvent.pointerDrag != null) { ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag); } }
protected override LayerHitResult beginTouch(ITouch touch, out ITouchHit hit) { hit = null; if (enabled == false || gameObject.activeInHierarchy == false) { return(LayerHitResult.Miss); } var result = movie.BeginTouch(touch.Id, touch.Position.x, touch.Position.y); return((LayerHitResult)result); }
private IEnumerator wait(ITouch touch) { // WaitForSeconds is affected by time scale! var targetTime = Time.unscaledTime + TimeToPress; while (targetTime > Time.unscaledTime) { yield return(null); } SuccessfulTouchIDs.Add(touch.Id); setState(GestureState.Changed); }
public void FollowTouch(ITouch touch) { var disposable = touch.ObserveEveryValueChanged(t => t.Position) .Subscribe( newPos => { Vector2 pos = Camera.main.ScreenToWorldPoint(new Vector3(newPos.x, newPos.y, 0.0f)); this.transform.position = new Vector3(pos.x, pos.y, 0.0f); } ); _disposables.Add(disposable); }
public static bool didTapInsideRect(Rect position) { ITouch iTouch = ServiceLocator.getITouch(); if (iTouch.checkTap()) { return(isTouchInsideRect(position)); } else { return(false); } }
public void FollowTouch(ITouch touch) { var disposable = touch.ObserveEveryValueChanged(t => t.Position) .Subscribe( newPos => { Vector2 pos = Camera.main.ScreenToWorldPoint(new Vector3(newPos.x, newPos.y, 0.0f)); this.transform.position = new Vector3(pos.x, pos.y, 0.0f); } ); _disposables.Add(disposable); }
public void touchMoved(ITouch touch) { ITouch dummy; if (!dummies.TryGetValue(touch.Id, out dummy)) return; var position = gameObject.GetComponent<Camera>().ScreenToWorldPoint(new Vector3(touch.Position.x, touch.Position.y, 1f)); var thisBox = boxes[touch.Id]; thisBox.transform.position = position; // if (touch.Type == "2dblb") // { // thisBox.transform.localScale = new Vector3 (touch.Size.x , touch.Size.y, 1f); // var angle = touch.Angle * 360f / (2 * Mathf.PI); // thisBox.transform.localRotation = Quaternion.Euler (0f,0f, - angle); // } }
public void touchBegin(ITouch touch) { ITouch dummy; if (dummies.TryGetValue(touch.Id, out dummy)) return; dummies.Add(touch.Id, touch); var position = gameObject.GetComponent<Camera>().ScreenToWorldPoint(new Vector3(touch.Position.x, touch.Position.y, 1f)); var newBox = Instantiate (box, position, Quaternion.identity) as GameObject; // if (touch.Type == "2dblb") // { // newBox.transform.localScale = new Vector3 (touch.Size.x , touch.Size.y, 1f); // var angle = touch.Angle * 360f / (2 * Mathf.PI); // newBox.transform.localRotation = Quaternion.Euler (0f,0f,angle); // } boxes.Add (touch.Id, newBox); }
protected override void ProcessOneTouch(ITouch touch) { switch (touch.phase) { case TouchPhase.Stationary: break; case TouchPhase.Ended: case TouchPhase.Canceled: InventoryContext.EventBus.DispatchEvent(default(InventoryDragEvents.GestureComplete)); break; case TouchPhase.Moved: onDrag(touch.position); break; } }
protected override void ProcessOneTouch(ITouch touch) { switch (touch.phase) { case TouchPhase.Stationary: break; case TouchPhase.Moved: onDrag(touch.position); break; case TouchPhase.Ended: case TouchPhase.Canceled: onDragEnd(touch); break; } }
/// <inheritdoc /> public override bool ShouldReceiveTouch(ITouch touch) { if (!IgnoreChildren) { return(base.ShouldReceiveTouch(touch)); } if (!base.ShouldReceiveTouch(touch)) { return(false); } if (touch.Target != cachedTransform) { return(false); } return(true); }
private void HandleTags(ITouch touch) { Tags tags = touch.Tags; if (tags.Count > 0) { Debug.Log (string.Format ("Tag detected: {0}", tags)); foreach (string tag in tags.TagList) { // Check whether this tag should be ignored e.g. Mouse etc. if (_ignoredTagNames.Contains (tag)) { Debug.Log (string.Format ("Ignoring tag: {0}", tag)); continue; } Vector3 worldPosition = Camera.main.ScreenToWorldPoint (new Vector3 (touch.Position.x, touch.Position.y, 0.0f)); // Check whether this tag is a tool tag if (_tagNameToToolDict.ContainsKey (tag)) { Debug.Log (string.Format ("Instantiating tool with tag: {0}", tag)); GameObject tool = (GameObject)Instantiate (_tagNameToToolDict [tag], worldPosition, Quaternion.identity); IToolController controller = tool.GetComponent<IToolController>(); if (controller != null) { _touchIDToolMap.Add(touch.Id, tool); controller.FollowTouch(touch); } } // If nothing else, search for Tweets with the tag else { Debug.Log (string.Format ("Instantiating tweets with tag: {0}", tag)); TweetManager.Instance.CreateTweets (tag, worldPosition); } } } }
public void Calibrate(ITouch touch) { var upperRightCorner = GetComponent<Camera> ().ScreenToWorldPoint (new Vector3 (Screen.width, Screen.height, 4f)); var lowerLeftCorner = GetComponent<Camera> ().ScreenToWorldPoint (new Vector3 (0, 0, 4f)); var indicatorPosition = GetComponent<Camera> ().ScreenToWorldPoint (new Vector3 (touch.Position.x, touch.Position.y, 4f)); var upRightQuat = OVRManager.display.GetHeadPose ().orientation; var h_ur = upRightQuat.y * Mathf.PI;// * 180f; var v_ur = 1.86f - upRightQuat.x * Mathf.PI;// * 180f; var surfaceHeight = GameObject.Find ("TouchSurface").transform.position.y; var eyePosition = GameObject.Find ("CenterEyeAnchor").transform.position; var eyeHeight = eyePosition.y - surfaceHeight; var x_pos = eyeHeight * Mathf.Tan(h_ur); var y_pos = eyeHeight * Mathf.Tan(v_ur); var position = new Vector3 (); position.x = x_pos; position.z = y_pos; position.y = surfaceHeight; if (indicatorPosition.x >= upperRightCorner.x - 0.5f && indicatorPosition.y >= upperRightCorner.y - 0.5f)// && !rSet) { upRight = position; rSet = true; if (lSet) { isCalibrated = true; DoCalibration(); } } else if (indicatorPosition.x <= lowerLeftCorner.x + 0.5f && indicatorPosition.y >= upperRightCorner.y - 0.5f)// && !lSet) { lowerLeft = position; yesOrNo = true; lSet = true; lowLeftQuat = OVRManager.display.GetHeadPose ().orientation; if (rSet) { isCalibrated = true; DoCalibration (); } } else RemoveOne (touch); }
/// <summary>Adds a point to cluster.</summary> /// <param name="point">A point.</param> public void AddPoint(ITouch point) { if (points.Contains(point)) return; points.Add(point); markDirty(); }
private void processMove(ITouch touch) { PointerEventData pointerEvent; getPointerData(touch.Id, out pointerEvent, true); pointerEvent.position = touch.Position; pointerEvent.delta = touch.Position - touch.PreviousPosition; raycastPointer(pointerEvent); var targetGO = pointerEvent.pointerCurrentRaycast.gameObject; HandlePointerExitAndEnter(pointerEvent, targetGO); bool moving = pointerEvent.IsPointerMoving(); if (moving && pointerEvent.pointerDrag != null && !pointerEvent.dragging && shouldStartDrag(pointerEvent.pressPosition, pointerEvent.position, eventSystem.pixelDragThreshold, pointerEvent.useDragThreshold)) { ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.beginDragHandler); pointerEvent.dragging = true; } // Drag notification if (pointerEvent.dragging && moving && pointerEvent.pointerDrag != null) { // Before doing drag we should cancel any pointer down state // And clear selection! if (pointerEvent.pointerPress != pointerEvent.pointerDrag) { ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler); pointerEvent.eligibleForClick = false; pointerEvent.pointerPress = null; pointerEvent.rawPointerPress = null; } ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.dragHandler); } }
private void processEnded(ITouch touch) { PointerEventData pointerEvent; getPointerData(touch.Id, out pointerEvent, true); pointerEvent.position = touch.Position; pointerEvent.delta = Vector2.zero; raycastPointer(pointerEvent); var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject; ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler); // see if we mouse up on the same element that we clicked on... var pointerUpHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo); // PointerClick and Drop events if (pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick) { ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler); } else if (pointerEvent.pointerDrag != null) { ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.dropHandler); } pointerEvent.eligibleForClick = false; pointerEvent.pointerPress = null; pointerEvent.rawPointerPress = null; if (pointerEvent.pointerDrag != null && pointerEvent.dragging) ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler); pointerEvent.dragging = false; pointerEvent.pointerDrag = null; // send exit events as we need to simulate this on touch up on touch device ExecuteEvents.ExecuteHierarchy(pointerEvent.pointerEnter, pointerEvent, ExecuteEvents.pointerExitHandler); pointerEvent.pointerEnter = null; removePointerData(pointerEvent); }
protected void processBegan(ITouch touch) { PointerEventData pointerEvent; getPointerData(touch.Id, out pointerEvent, true); pointerEvent.position = touch.Position; pointerEvent.button = PointerEventData.InputButton.Left; pointerEvent.eligibleForClick = true; pointerEvent.delta = Vector2.zero; pointerEvent.dragging = false; pointerEvent.useDragThreshold = true; pointerEvent.pressPosition = pointerEvent.position; raycastPointer(pointerEvent); pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast; var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject; deselectIfSelectionChanged(currentOverGo, pointerEvent); if (pointerEvent.pointerEnter != currentOverGo) { // send a pointer enter to the touched element if it isn't the one to select... HandlePointerExitAndEnter(pointerEvent, currentOverGo); pointerEvent.pointerEnter = currentOverGo; } // search for the control that will receive the press // if we can't find a press handler set the press // handler to be what would receive a click. var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler); // didnt find a press handler... search for a click handler if (newPressed == null) newPressed = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo); // TODO: double-tap pointerEvent.clickCount = 1; pointerEvent.pointerPress = newPressed; pointerEvent.rawPointerPress = currentOverGo; pointerEvent.clickTime = Time.unscaledTime; // Save the drag handler as well pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>(currentOverGo); if (pointerEvent.pointerDrag != null) ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag); }
private void updateDummy(ITouch dummy) { dummies[dummy.Id] = dummy; }
private void updateObjectProperties(ITouch touch, TuioObject obj) { var props = touch.Properties; props["Angle"] = obj.Angle; props["ObjectId"] = obj.ClassId; props["RotationVelocity"] = obj.RotationVelocity; props["RotationAcceleration"] = obj.RotationAcceleration; }
public Tap(ITouch tap) : base(1) { this.gestureTouches.Add(tap); }
/// <summary>Removes a point from cluster.</summary> /// <param name="point">A point.</param> public void RemovePoint(ITouch point) { if (!points.Contains(point)) return; points.Remove(point); markDirty(); }
/// <inheritdoc /> protected override bool shouldCacheTouchPosition(ITouch value) { // Points must be over target when released return GetTargetHitResult(value.Position); }
/// <summary> /// Should the gesture cache this touch to use it later in calculation of <see cref="ScreenPosition"/>. /// </summary> /// <param name="value">Touch to cache.</param> /// <returns><c>true</c> if touch should be cached; <c>false</c> otherwise.</returns> protected virtual bool shouldCacheTouchPosition(ITouch value) { return true; }
/// <summary> /// Specifies if gesture can receive this specific touch point. /// </summary> /// <param name="touch">The touch.</param> /// <returns><c>true</c> if this touch should be received by the gesture; otherwise, <c>false</c>.</returns> public virtual bool ShouldReceiveTouch(ITouch touch) { if (Delegate == null) return true; return Delegate.ShouldReceiveTouch(this, touch); }
/// <summary> /// Determines whether gesture controls a touch point. /// </summary> /// <param name="touch">The touch.</param> /// <returns> /// <c>true</c> if gesture controls the touch point; otherwise, <c>false</c>. /// </returns> public bool HasTouch(ITouch touch) { return activeTouches.Contains(touch); }
/// <inheritdoc /> public bool Equals(ITouch other) { if (other == null) return false; return Id == other.Id; }
private IEnumerator wait(ITouch touch) { // WaitForSeconds is affected by time scale! var targetTime = Time.unscaledTime + TimeToPress; while (targetTime > Time.unscaledTime) yield return null; SuccessfulTouchIDs.Add(touch.Id); setState(GestureState.Changed); }
private void removeDebugFigureForTouch(ITouch touch) { GLDebug.RemoveFigure(TouchManager.DEBUG_GL_TOUCH + touch.Id); }
public FreeDrag(ITouch drag) : base(1) { this.gestureTouches.Add(drag); }
private void addDebugFigureForTouch(ITouch touch) { GLDebug.DrawSquareScreenSpace(TouchManager.DEBUG_GL_TOUCH + touch.Id, touch.Position, 0, debugTouchSize, GLDebug.MULTIPLY, float.PositiveInfinity); }
public DoubleDrag(ITouch touch1, ITouch touch2) : base(2) { this.gestureTouches.Add(touch1); this.gestureTouches.Add(touch2); }
private void updateBlobProperties(ITouch touch, TuioBlob blob) { var props = touch.Properties; props["Angle"] = blob.Angle; props["Width"] = blob.Width; props["Height"] = blob.Height; props["Area"] = blob.Area; props["RotationVelocity"] = blob.RotationVelocity; props["RotationAcceleration"] = blob.RotationAcceleration; }