public void NextFrame() { if (currentTouchIndex >= touchInfos.Length && currentFrameIndex > touchInfos[touchInfos.Length].Frame) { targetPointer.RevertTouchUp(); return; } if (currentTouchIndex == 0 && currentFrameIndex == 0) { targetPointer.TouchDown(); } var currentTouch = touchInfos[currentTouchIndex]; Vector3 min = targeTransform.TransformPoint(targeTransform.rect.min + new Vector2(currentTouch.X, currentTouch.Y)); //Vector3 max = rectTransform.TransformPoint(rectTransform.rect.max); var min2D = RectTransformUtility.WorldToScreenPoint(Camera.main, min); targetPointer.position = min2D; currentFrameIndex++; //if(currentFrameIndex) }
public bool CanClick(String buttonName) { var pointerDataBacup = CurrentPointerData; recordExecuteEvent.SkipSendTouch = true; var selectedGameObjectBacup = EventSystem.current.currentSelectedGameObject; var founds = FindGameObject(buttonName).Where(gOb => gOb.ExitHander <Selectable>()).ToArray(); if (founds.Length > 1) { Debug.LogError(founds.Length + " Button found with name " + buttonName); } else if (founds.Length == 0) { return(false); } var target = founds[0]; var rectTransform = target.transform as RectTransform; Vector3 min = rectTransform.TransformPoint((rectTransform.rect.min + rectTransform.rect.max) / 2); var min2D = RectTransformUtility.WorldToScreenPoint(Camera.main, min); var inputModule = Object.FindObjectOfType <StandaloneInputModule>(); CurrentPointerData = new PointerData() { position = min2D }; CurrentPointerData.TouchDown(); CurrentPointerData.TouchUp(); didProcessThisFrame = false; inputModule.Process(); CurrentPointerData.RevertTouchDown(); CurrentPointerData.RevertTouchUp(); var clickGameObject = CurrentPointerData.SelectGameObject; CurrentPointerData = pointerDataBacup; recordExecuteEvent.SkipSendTouch = false; EventSystem.current.SetSelectedGameObject(selectedGameObjectBacup); return(clickGameObject == target); }
private void TouchDown() { CurrentPointerData.TouchDown(); }